Skip to content

Commit 804a2b2

Browse files
authored
Add Comments and ASCII Art
1 parent 12213c4 commit 804a2b2

File tree

1 file changed

+54
-8
lines changed

1 file changed

+54
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,59 @@
1-
#include "Nicla_System.h"
1+
/*
2+
Blink for Nicla Sense ME
3+
4+
Turns green LED on for one second, then turn it off.
5+
6+
Most Arduino boards have a single LED connected from D13 to ground
7+
(with a current limiting resistor). In the Nicla Sense ME, the common
8+
anode RGB LED (DL1) is controlled by a RGB LED Driver (U8).
9+
The RGB LED Driver state is set via I2C by the ANNA-B112 Module (MD1).
10+
11+
┌────────────┐ ┌────────────┐
12+
│ ANNA-B112 │ │ RGB-Driver │ VPMID
13+
│ MD-1 │ │ U8 │ Red ─┬─
14+
│ │ │ OUT3├────────◄──────┐ │
15+
│ │ I2C │ │ Green│ │
16+
│ ├──────┤ OUT2├────────◄──────┼───┘
17+
│ │ │ │ Blue │
18+
│ │ │ OUT1├────────◄──────┘
19+
│ │ │ │
20+
│ │ │ │
21+
│ │ │ │
22+
└────────────┘ └────────┬───┘
23+
24+
25+
26+
All of this is abstracted via the Nicla_System.h header file. Details
27+
on use for controling RGB LED can be found at:
28+
https://docs.arduino.cc/tutorials/nicla-sense-me/cheat-sheet#rgb-led
29+
30+
More advanced users can look at the source code at:
31+
https://github.com/arduino/ArduinoCore-mbed/blob/master/libraries/Nicla_System/src/Nicla_System.h
32+
33+
Authors: Giulia Cioffi, Martino Facchin & Ali Jahangiri
34+
35+
This example code is in the public domain.
36+
37+
Last edit: 2nd February 2023
38+
*/
39+
40+
// Intialise library which communicates with RGB driver
41+
// Functions accessible under 'nicla' namespace
42+
#include "Nicla_System.h"
43+
244

345
void setup() {
4-
nicla::begin();
5-
nicla::leds.begin();
46+
//run this code once when Nicla Sense ME board turns on
47+
nicla::begin(); // initialise library
48+
nicla::leds.begin(); // Start I2C connection
649
}
750

851
void loop() {
9-
nicla::leds.setColor(green);
10-
delay(1000);
11-
nicla::leds.setColor(off);
12-
delay(1000);
13-
}
52+
//run this code in a loop
53+
nicla::leds.setColor(green); //turn green LED on
54+
delay(1000); //wait 1 second
55+
nicla::leds.setColor(off); //turn all LEDs off
56+
delay(1000); //wait 1 second
57+
}
58+
59+

0 commit comments

Comments
 (0)