mirror of
https://github.com/digistump/DigistumpArduino.git
synced 2025-04-27 23:29:01 -07:00
28 lines
426 B
C++
28 lines
426 B
C++
int irPin=2;
|
|
|
|
void setup()
|
|
{
|
|
pinMode(irPin,INPUT);
|
|
pinMode(0,OUTPUT);
|
|
//Serial.begin(9600);
|
|
digitalWrite(0,HIGH);
|
|
//Serial.println("You pressed a button");
|
|
delay(1000);
|
|
digitalWrite(0,LOW);
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
|
|
if(pulseIn(irPin,LOW))
|
|
{
|
|
//button pressed
|
|
delay(100);
|
|
digitalWrite(0,HIGH);
|
|
//Serial.println("You pressed a button");
|
|
delay(1000);
|
|
digitalWrite(0,LOW);
|
|
}
|
|
|
|
}
|