You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***The built-in RGB LED on the Nano 33 BLE Sense Rev2 uses __inverted logic__. This means that a voltage level of `LOW` on each of their pins will turn the specific color of the LED on, and a voltage level of `HIGH` will turn them off.***
249
253
250
-
The following example sketch each of the RGB LED colors at an interval of 500 ms:
254
+
The following example sketch controls each of the RGB LED colors at an interval of 500 ms:
251
255
252
256
```arduino
253
257
/**
254
-
RGB LED Example for the Arduino Nano 33 BLE Sense BLE Sense Rev2
258
+
RGB LED Example for the Arduino Nano 33 BLE Sense Rev2 Board
255
259
Name: nano_33_ble_sense_rev2_rgb_led.ino
256
260
Purpose: This sketch demonstrates how to control the built-in
257
261
RGB LED of the Arduino Nano 33 BLE Sense Rev2 board.
258
262
263
+
@author Arduino Product Experience Team
264
+
@version 1.0 01/06/25
259
265
*/
260
266
261
267
void setup() {
262
-
// Initialize serial communication and wait up to 2.5 seconds for a connection
268
+
// Initialize serial communication and wait up to 2.5 seconds for connection
// Turn off all LEDs initially (HIGH = OFF for inverted logic)
281
+
digitalWrite(LEDR, HIGH);
282
+
digitalWrite(LEDG, HIGH);
283
+
digitalWrite(LEDB, HIGH);
275
284
276
285
Serial.println("- Arduino Nano 33 BLE Sense Rev2 - RGB LED Example started...");
277
286
}
278
287
279
288
void loop() {
280
289
// Turn on the built-in red LED and turn off the rest
281
-
digitalWrite(LEDR, HIGH);
282
-
digitalWrite(LEDG, LOW);
283
-
digitalWrite(LEDB, LOW);
290
+
digitalWrite(LEDR, LOW); // ON
291
+
digitalWrite(LEDG, HIGH); // OFF
292
+
digitalWrite(LEDB, HIGH); // OFF
284
293
Serial.println("- Red LED on!");
285
294
delay(500);
286
295
287
296
// Turn on the built-in green LED and turn off the rest
288
-
digitalWrite(LEDR, LOW);
289
-
digitalWrite(LEDG, HIGH);
290
-
digitalWrite(LEDB, LOW);
297
+
digitalWrite(LEDR, HIGH); // OFF
298
+
digitalWrite(LEDG, LOW); // ON
299
+
digitalWrite(LEDB, HIGH); // OFF
291
300
Serial.println("- Green LED on!");
292
301
delay(500);
293
302
294
303
// Turn on the built-in blue LED and turn off the rest
295
-
digitalWrite(LEDR, LOW);
296
-
digitalWrite(LEDG, LOW);
297
-
digitalWrite(LEDB, HIGH);
304
+
digitalWrite(LEDR, HIGH); // OFF
305
+
digitalWrite(LEDG, HIGH); // OFF
306
+
digitalWrite(LEDB, LOW); // ON
298
307
Serial.println("- Blue LED on!");
299
308
delay(500);
300
309
301
310
// Turn off all LEDs
302
-
digitalWrite(LEDR, LOW);
303
-
digitalWrite(LEDG, LOW);
304
-
digitalWrite(LEDB, LOW);
311
+
digitalWrite(LEDR, HIGH); // OFF
312
+
digitalWrite(LEDG, HIGH); // OFF
313
+
digitalWrite(LEDB, HIGH); // OFF
305
314
Serial.println("- All LEDs off!");
306
315
delay(500);
307
316
}
308
317
```
309
318
310
319
You should now see the built-in RGB LED cycling through red, green, and blue colors, followed by a brief moment with all LEDs off, repeating this pattern continuously.
311
320
321
+

322
+
312
323
Additionally, you can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see the status messages that the example sketch sends each time the RGB LEDs state changes.
313
324
325
+

326
+
314
327
### Orange LED
315
328
316
329
The Nano 33 BLE Sense Rev2 also features a built-in orange user LED that can be used for basic status indications and debugging purposes.
317
330
331
+

332
+
318
333
The built-in user LED can be accessed through the following macro definition:
***Unlike the RGB LED, the built-in orange user LED on the Nano 33 BLE Sense Rev2 operates with standard logic levels. This means that a voltage level of `HIGH` will turn the LED on, and a voltage level of `LOW` will turn it off.***
340
+
341
+
The following example sketch demonstrates how to control the built-in user LED:
342
+
343
+
```arduino
344
+
/**
345
+
User LED Example for the Arduino Nano 33 BLE Sense Rev2 Board
346
+
Name: nano_33_ble_sense_rev2_user_led.ino
347
+
Purpose: This sketch demonstrates how to control the built-in
348
+
orange user LED of the Arduino Nano 33 BLE Sense Rev2 board.
349
+
350
+
@author Arduino Product Experience Team
351
+
@version 1.0 01/06/25
352
+
*/
353
+
354
+
void setup() {
355
+
// Initialize serial communication and wait up to 2.5 seconds for connection
356
+
Serial.begin(115200);
357
+
unsigned long startTime = millis();
358
+
while (!Serial && millis() - startTime < 2500) {
359
+
delay(100);
360
+
}
361
+
362
+
// Configure LED_BUILTIN pin as output
363
+
pinMode(LED_BUILTIN, OUTPUT);
364
+
365
+
// Turn off LED initially
366
+
digitalWrite(LED_BUILTIN, LOW);
367
+
368
+
Serial.println("- Arduino Nano 33 BLE Sense Rev2 - User LED Example started...");
369
+
}
370
+
371
+
void loop() {
372
+
// Turn on the built-in user LED
373
+
digitalWrite(LED_BUILTIN, HIGH);
374
+
Serial.println("- User LED on!");
375
+
delay(1000);
376
+
377
+
// Turn off the built-in user LED
378
+
digitalWrite(LED_BUILTIN, LOW);
379
+
Serial.println("- User LED off!");
380
+
delay(1000);
381
+
}
382
+
```
383
+
384
+
You should now see the built-in orange user LED blinking on and off at 1-second intervals, repeating this pattern continuously.
385
+
386
+

387
+
388
+
Additionally, you can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see the status messages that the example sketch sends each time the user LED state changes
389
+
390
+

391
+
324
392
## Pins
325
393
326
394
This user manual section provides comprehensive information about the Nano 33 BLE Sense Rev2's pin capabilities and functionality. Understanding the board's pins capabilities and configurations is important for making the most of your projects with the Nano 33 BLE Sense Rev2 board.
0 commit comments