Commits

ricklon  committed 99ef7b0

Updated the code for working buttons and firing the solenoids. More testing is needed.
Meed to find out why some buttons work and some fail.

  • Participants
  • Parent commits b7237a2

Comments (0)

Files changed (1)

File WineInABoxBot/WineInABoxBot.pde

 */
 
 //button debounce code based on the LadyAda debounce code
-#define DEBOUNCE 10 
+#define DEBOUNCE 20 
 
 // here is where we define the buttons that we'll use. button "1" is the first, button "6" is the 6th, etc
 byte buttons[] = {9, 10 , 11, 12}; // the analog 0-5 pins are also known as 14-19
       Serial.print(i, DEC);
       Serial.println(" Just released");
       // remember, check_switches() will CLEAR the 'just pressed' flag
+      if (i == 0) 
+      {
+         Serial.print(i, DEC);
+         Serial.println(" sol1 off");
+         digitalWrite(sol1[0],LOW);
+         digitalWrite(sol1[1], LOW); 
+      }
+      if (i == 3)
+      {
+        digitalWrite(sol1[0],LOW);
+        digitalWrite(sol1[1], LOW); 
+      }
+
     }
     if (pressed[i]) {
       Serial.print(i, DEC);
       Serial.println(" pressed");
       // is the button pressed down at this moment
+      if (i == 0) 
+      {
+         Serial.print(i, DEC);
+         Serial.println(" sol1 fired");
+         digitalWrite(sol1[0],LOW);
+         digitalWrite(sol1[1], HIGH); 
+      }
+      if (i == 3)
+      {
+        digitalWrite(sol1[0],LOW);
+        digitalWrite(sol1[1], LOW); 
+      }
     }
   }