-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLED_Test.ino
More file actions
49 lines (41 loc) · 1.2 KB
/
LED_Test.ino
File metadata and controls
49 lines (41 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include "../generic/common.h"
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)
static const uint8_t D0 = 16;
static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
static const uint8_t D7 = 13;
static const uint8_t D8 = 15;
static const uint8_t D9 = 3;
static const uint8_t D10 = 1;
#endif /* Pins_Arduino_h */
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
pinMode(D7,INPUT_PULLUP);
}
int check = 0;
int current = 0;
void loop() {
// put your main code here, to run repeatedly:
check = digitalRead(D7);
if (check == LOW){
if (current == 1){
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is acive low on the ESP-01)
current = 0;
}
else if (current == 0 ){
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
current = 1;
}
delay(250);
}
}