/* BarBotButtonPanel Driver by Justin Day (C)2008 NYC Resistor Heavy Industries Controls the button panel on BarBot. Change the values of the constants below to control the number of buttons controlled and what drinks those make. Will listen for button presses and queue drinks into a string until the magicString is received on serial. Once the magicString is received in full, spit out the drink order and reset. */ // CHANGE THESE VALUES!! #define DEBUG 0 int numberOfDrinks = 2; // The number of drinks we can make int buttons[] = { 7, 8 }; // The button inputs char drinks[] = { 'a', 'b' }; // The drink names (single chars) char *magicString = "+ORDER-"; // The magic string to send on char *orderPrefix = "+MAKE "; // Prefix before drink list char *orderSuffix = "~"; // Suffix after drink list // DON'T CHANGE THESE!! char order[255] = ""; // String that holds the order, max 255 drinks! int magicPosition = 0; // Holds the position we've read up to in magicString int magicLength = 0; // Holds the length of magicString char in; // Input charater int val = 0; // Button press value int pressed = 0; // Button pressed trigger (for debouncing) void setup() { // Set up serial Serial.begin(9600); // Precompute the length of magicString magicLength = strlen(magicString); // Set up buttons as input for (int i=0; i