Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://imgur.com/a/N8xWKFg
- int sensorState = 0;
- void setup()
- {
- pinMode(2, INPUT);
- pinMode(LED_BUILTIN, OUTPUT);
- }
- void loop()
- {
- // read the state of the sensor/digital input
- sensorState = digitalRead(2);
- // check if sensor pin is HIGH. if it is, set the
- // LED on.
- if (sensorState == HIGH) {
- digitalWrite(LED_BUILTIN, HIGH);
- } else {
- digitalWrite(LED_BUILTIN, LOW);
- }
- delay(10); // Delay a little bit to improve simulation performance
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement