summaryrefslogtreecommitdiff
path: root/Origin/user-code/push/arduino/led-push-button/led-push-button.ino
blob: 928b7cd3b972c0342f75d77b39f7f50f26ef4ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const int sensorPin = 12;    
const int ledPin = 9;      
int sensorValue = 0;  
int i;
void setup() {
  Serial.begin(115200);  
  pinMode(sensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
  for (i = 0; i < 50; i++) {
    sensorValue = digitalRead(sensorPin);
    Serial.println(sensorValue); // print it at the Serial Monitor
    if (sensorValue == 0) {
      digitalWrite(ledPin, LOW);
      delay(200);
    } 
    else { 
     digitalWrite(ledPin, HIGH);
     delay(200);
    } 
  }
}
void loop() {
}