Skip to content

Commit c09e900

Browse files
authored
Merge pull request #1724 from arduino/karlsoderby/esp32-default-sketch
[Nano ESP32] Add default sketch
2 parents b5a8660 + 887018c commit c09e900

File tree

1 file changed

+46
-0
lines changed
  • content/hardware/03.nano/boards/nano-esp32/tutorials/cheat-sheet

1 file changed

+46
-0
lines changed

content/hardware/03.nano/boards/nano-esp32/tutorials/cheat-sheet/cheat-sheet.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,52 @@ In addition to the normal bootloader-mode, the Arduino Nano ESP32 lets you enter
107107

108108
If you need to reflash the bootloader, you can follow the steps of this [Help Center article](https://support.arduino.cc/hc/en-us/articles/9810414060188-Reset-the-Arduino-bootloader-on-the-Nano-ESP32)
109109

110+
### Default Sketch
111+
112+
The default sketch loaded on the Nano ESP32 board is found in the code snippet below:
113+
114+
```arduino
115+
#define LEDR 46
116+
#define LEDG 45
117+
#define LEDB 0
118+
#ifdef LED_BUILTIN
119+
#undef LED_BUILTIN
120+
#define LED_BUILTIN 48
121+
#endif
122+
123+
void setup() {
124+
// put your setup code here, to run once:
125+
pinMode(LEDR, OUTPUT);
126+
pinMode(LEDG, OUTPUT);
127+
pinMode(LEDB, OUTPUT);
128+
pinMode(LED_BUILTIN, OUTPUT);
129+
}
130+
131+
void loop() {
132+
digitalWrite(LED_BUILTIN, HIGH);
133+
digitalWrite(LEDR, LOW);
134+
digitalWrite(LEDG, HIGH);
135+
digitalWrite(LEDB, HIGH);
136+
137+
delay(1000);
138+
139+
digitalWrite(LED_BUILTIN, LOW);
140+
digitalWrite(LEDR, HIGH);
141+
digitalWrite(LEDG, LOW);
142+
digitalWrite(LEDB, HIGH);
143+
144+
delay(1000);
145+
146+
digitalWrite(LED_BUILTIN, HIGH);
147+
digitalWrite(LEDR, HIGH);
148+
digitalWrite(LEDG, HIGH);
149+
digitalWrite(LEDB, LOW);
150+
151+
delay(1000);
152+
digitalWrite(LED_BUILTIN, LOW);
153+
}
154+
```
155+
110156
## MicroPython
111157

112158
The Nano ESP32 has support for MicroPython, a micro-implementation of Python® that can easily be installed on your board.

0 commit comments

Comments
 (0)