I am using a code I got from the web to control stepping up/down 5 led’s with the use of two push buttons. However when i compile the sketch I get an error code telling me BYTE is not supported by 1.0 use serial.write() instead. BUT it says BYTE nowhere in my sketch… HELP please!!!
// Example 03C: Turn on LED when the button is pressed
#include <Bounce.h>
#define NUM_MOODS 5
#define NEUTRAL ((NUM_MOODS - 1) / 2)
#define UP ‘+’
#define DOWN ‘-’
#define QUERY ‘?’
#define NONE -1
int ledPins[NUM_MOODS] = {6, 7, 8, 9, 10};
int heartbeatPin = 13;
int upPin = 2;
int downPin = 3;
Bounce upButton (upPin, 100);
** Bounce downButton (downPin, 100);**
int mood = NEUTRAL;
void setup() {
for (int i = 0; i < NUM_MOODS; ++i) {
pinMode(ledPins*, OUTPUT);*
-
}*
-
pinMode(upPin, INPUT);*
-
pinMode(downPin, INPUT);*
-
Serial.begin(9600);*
-
setMood(NEUTRAL);*
-
}*
void loop() { -
upButton.update();*
-
downButton.update();*
-
int button = (upButton.fallingEdge() ? UP :*
-
(downButton.fallingEdge() ? DOWN : NONE));*
-
int serial = (Serial.available() > 0 ? Serial.read() : NONE);*
-
int event = (button != NONE ? button : serial);*
-
switch (event) {*
-
case UP:*
-
setMood(mood + 1);*
-
break;*
-
case DOWN:*
-
setMood(mood - 1);*
-
break;*
-
case QUERY:*
-
Serial.print(‘0’ + mood, BYTE);*
-
break;*
-
default:*
-
setMood(event - ‘0’);*
-
break;*
-
}*
-
digitalWrite(heartbeatPin, HIGH);*
-
delay(50);*
-
digitalWrite(heartbeatPin, LOW);*
-
delay(50);*
-
}*
void setMood(int newMood) { -
if (newMood < 0 || newMood >= NUM_MOODS) {*
-
return;*
-
}*
-
digitalWrite(ledPins[mood], LOW);*
-
mood = newMood;*
-
digitalWrite(ledPins[mood], HIGH);*
-
}*
The problem is in bold in my sketch