Skip to content

Commit 0682d37

Browse files
authored
fix(rmt): fixes the example to wait for rmt TX
1 parent 5ab1ee5 commit 0682d37

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libraries/ESP32/examples/RMT/RMT_LED_Blink/RMT_LED_Blink.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,22 @@ void RMT_Repeated_Write_Blink() {
281281
Serial.println("Using RMT Writing repeated N times to blink an LED.");
282282
Serial.println("Blinking at 1s on + 1s off :: 2 blinks");
283283
// repeating blink_1s_rmt_data (1s on + 1s off) 2 times for 2 blinks
284-
if (!rmtWriteRepeated(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 1, 2)) {
284+
if (!rmtWriteRepeated(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data), 2)) {
285285
Serial.println("===> rmtWrite Blink 1s Error!");
286286
}
287+
delay(4000 + 1000); // it should blink 2 times and stop automatically
287288
Serial.println("Blinking at 500ms on + 500ms off :: 4 blinks");
288289
// repeating blink_500ms_rmt_data (500ms on + 500ms off) 4 times for 4 blinks
289-
if (!rmtWriteRepeated(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data) - 1, 4)) {
290+
if (!rmtWriteRepeated(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data), 4)) {
290291
Serial.println("===> rmtWrite Blink 0.5s Error!");
291292
}
293+
delay(4000 + 1000); // it should blink 4 times and stop automatically
292294
Serial.println("Blinking at 250ms on + 250ms off :: 8 blinks");
293295
// repeating blink_250ms_rmt_data (250ms on + 250ms off) 8 times for 8 blinks
294-
if (!rmtWriteRepeated(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data) - 1, 8)) {
296+
if (!rmtWriteRepeated(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data), 8)) {
295297
Serial.println("===> rmtWrite Blink 0.25s Error!");
296298
}
299+
delay(4000 + 1000); // it should blink 8 times and stop automatically
297300
Serial.println("Blinking is OFF for 2 seconds");
298301
delay(2000);
299302
}

0 commit comments

Comments
 (0)