Не работает скетч

Тема в разделе "Arduino & Shields", создана пользователем nedfart, 21 июл 2016.

  1. nedfart

    nedfart Нерд

    Скетч не проходит проверку перед загрузкой на Arduino выдаёт ошибку "lastButton" was not declared in this scope


    const int BLED=9;
    const int GLED=10;
    const int RLED=11;
    const int BUTTON=2;

    boolean lasstButton = LOW;
    boolean currentButton = LOW;
    int ledMode = 0;

    void setup() {
    pinMode (BLED, OUTPUT);
    pinMode (GLED, OUTPUT);
    pinMode (RLED, OUTPUT);
    pinMode (BUTTON, INPUT);
    }

    boolean debounce (boolean last) {
    boolean current = digitalRead(BUTTON);
    if(last != current) {
    delay(5);
    current = digitalRead(BUTTON);
    return current;
    }
    }

    void setMode (int mode) {
    if (mode == 1) {
    digitalWrite (RLED, HIGH);
    digitalWrite (GLED, LOW);
    digitalWrite (BLED, LOW);
    }
    else if (mode == 2) {
    digitalWrite (RLED, LOW);
    digitalWrite (GLED, HIGH);
    digitalWrite (BLED, LOW);
    }

    else if (mode == 3) {
    digitalWrite (RLED, LOW);
    digitalWrite (GLED, LOW);
    digitalWrite (BLED, HIGH);
    }

    else if (mode == 4) {
    analogWrite (RLED, 127);
    analogWrite (GLED, 0);
    analogWrite (BLED, 127);
    }

    else if (mode == 5) {
    analogWrite (RLED, 0);
    analogWrite (GLED, 127);
    analogWrite (BLED, 127);
    }

    else if (mode == 6) {
    analogWrite (RLED, 127);
    analogWrite (GLED, 127);
    analogWrite (BLED, 0);
    }

    else if (mode == 7) {
    analogWrite (RLED, 85);
    analogWrite (GLED, 85);
    analogWrite (BLED, 85);
    }

    else {
    digitalWrite (RLED, LOW);
    digitalWrite (GLED, LOW);
    digitalWrite (BLED, LOW);
    }
    }

    void loop() {

    currentButton = debounce(lastButton); //ЗДЕСЬ ОН НАХОДИТ ОШИБКУ ("lastButton" was not declared in this scope)
    if (lastButtone == LOW && currentButton == HIGH) {
    ledMode++;
    }

    lastButtone = currentButtone;
    if (ledMode == 8)
    ledMod

    e=0;
    setMode (ledMode);
    }
     
  2. Vetrinus

    Vetrinus Гик

    lasstButton в объявлении переменной. Исправьте
     
  3. obuhanoe

    obuhanoe Гик

    лишняя s
     
  4. nedfart

    nedfart Нерд

    Да точно, спасибо.