File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include " Arduino.h"
2
+ int val = 0 ;
3
+ void setup ()
4
+ {
5
+ pinMode (LED_BUILTIN, OUTPUT);
6
+ pinMode (23 , OUTPUT);
7
+ }
8
+
9
+ void loop ()
10
+ {
11
+ digitalWrite (LED_BUILTIN, 0 );
12
+ digitalWrite (23 , val);
13
+ delay (1000 );
14
+ digitalWrite (LED_BUILTIN, 1 );
15
+ digitalWrite (23 , 1 );
16
+ delay (1000 );
17
+ }
Original file line number Diff line number Diff line change
1
+ #include " Arduino.h"
2
+ int ledPin = 22 ; // LED connected to digital pin 13
3
+ int inPin = 25 ; // pushbutton connected to digital pin 7
4
+ int val; // variable to store the read value
5
+
6
+ void setup () {
7
+ pinMode (ledPin, OUTPUT); // sets the digital pin 13 as output
8
+ pinMode (inPin, INPUT_PULLDOWN); // sets the digital pin 7 as input
9
+ }
10
+
11
+ void loop () {
12
+ val = digitalRead (inPin); // read the input pin
13
+ digitalWrite (ledPin, val); // sets the LED to the button's value
14
+ }
15
+
You can’t perform that action at this time.
0 commit comments