This commit is contained in:
commit
cf4bd41c24
1 changed files with 39 additions and 0 deletions
39
photoboothbuttons.pde
Normal file
39
photoboothbuttons.pde
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
int stbuttonPin = 2; // change to whatever you want
|
||||||
|
int tkbuttonPin = 3;
|
||||||
|
int ledPin = 13; // just using for example
|
||||||
|
boolean tkoldval = HIGH;
|
||||||
|
boolean stoldval = HIGH;
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
pinMode(ledPin, OUTPUT); // LED as output
|
||||||
|
pinMode(stbuttonPin, INPUT); // button as input
|
||||||
|
digitalWrite(stbuttonPin, HIGH); // turns on pull-up resistor after input
|
||||||
|
pinMode(tkbuttonPin, INPUT); // button as input
|
||||||
|
digitalWrite(tkbuttonPin, HIGH); // turns on pull-up resistor after input
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
tkoldval = digitalRead(tkbuttonPin);
|
||||||
|
stoldval = digitalRead(stbuttonPin);
|
||||||
|
if( (tkoldval == HIGH) &(digitalRead(tkbuttonPin) == LOW )) // when pin goes LOW
|
||||||
|
{
|
||||||
|
Serial.println('t');
|
||||||
|
digitalWrite(ledPin, HIGH); // turn on LED
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
if( (stoldval == HIGH) & (digitalRead(stbuttonPin) == LOW )) // when pin goes LOW
|
||||||
|
{
|
||||||
|
Serial.println('s');
|
||||||
|
digitalWrite(ledPin, HIGH); // turn on LED
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalWrite(ledPin, LOW); // well, turns led off!
|
||||||
|
//delay(1000); //one second delay
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in a new issue