Skip to content

Commit 7b5209e

Browse files
authored
Merge pull request #1315 from arduino/karlsoderby/minima-rx-tx-lds
[UNO R4] TX/RX LEDs docs
2 parents 9d17fa4 + fb8ac69 commit 7b5209e

File tree

1 file changed

+33
-0
lines changed
  • content/hardware/02.hero/boards/uno-r4-minima/tutorials/cheat-sheet

1 file changed

+33
-0
lines changed

content/hardware/02.hero/boards/uno-r4-minima/tutorials/cheat-sheet/cheat-sheet.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,39 @@ In addition, analog pins A0-A5 can also be used as digital pins. Note that **A4/
188188

189189
The reference voltage of all digital pins is 5 V.
190190

191+
## LED
192+
193+
The UNO R4 Minima has a total of four LEDs, three of which are programmable:
194+
- **ON** - power LED, cannot be programmed.
195+
- `LED_BUILTIN` - classic "built-in LED", attached to pin 13.
196+
- `RX_LED` - LED labelled "RX" on the board.
197+
- `TX_LED` - LED labelled "TX" on the board.
198+
199+
To control these, define them as outputs and write desired state. The below example blinks each LED every second.
200+
201+
```arduino
202+
void setup(){
203+
//define pins as output
204+
pinMode(LED_BUILTIN, OUTPUT);
205+
pinMode(RX_LED, OUTPUT);
206+
pinMode(TX_LED, OUTPUT);
207+
}
208+
209+
void loop(){
210+
//turn on all LEDs
211+
digitalWrite(LED_BUILTIN, HIGH);
212+
digitalWrite(LED_RX, HIGH);
213+
digitalWrite(LED_TX, HIGH);
214+
delay(1000);
215+
216+
//turn off all LEDs
217+
digitalWrite(LED_BUILTIN, LOW);
218+
digitalWrite(LED_RX, LOW);
219+
digitalWrite(LED_TX, LOW);
220+
delay(1000);
221+
}
222+
```
223+
191224
## DAC
192225

193226
![DAC Pin](assets/dacpin.png)

0 commit comments

Comments
 (0)