Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Atiriya Iyer
- * Veriation 2
- * Learning Digital Inputs
- */
- const int pinLED = 7;
- const int pinButton = 2;
- int readValue = 0;
- boolean lightOn = 0;
- void setup() {
- // put your setup code here, to run once:
- pinMode (pinButton, INPUT);
- pinMode (pinLED, OUTPUT);
- Serial.begin(9600);
- digitalWrite(pinLED, HIGH);
- delay(50);
- digitalWrite(pinLED, LOW);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- readValue= digitalRead(pinButton);
- if(readValue==1)
- {
- lightOn= !lightOn;
- digitalWrite(pinLED, lightOn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement