Skip to content

Commit 84bd6b2

Browse files
committed
Merge branch 'master' of github.com:arduino/ArduinoCore-mbed
2 parents a6fc683 + 5829f15 commit 84bd6b2

File tree

1 file changed

+59
-8
lines changed

1 file changed

+59
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,64 @@
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+
//This sketch is only for the Nicla Sense ME, not the Nicla Vision
41+
#ifdef ARDUINO_NICLA_VISION
42+
#error "Run the standard Blink.ino sketch for the Nicla Vision"
43+
#endif
44+
45+
// Intialise library which communicates with RGB driver
46+
// Functions accessible under 'nicla' namespace
47+
#include "Nicla_System.h"
48+
249

350
void setup() {
4-
nicla::begin();
5-
nicla::leds.begin();
51+
//run this code once when Nicla Sense ME board turns on
52+
nicla::begin(); // initialise library
53+
nicla::leds.begin(); // Start I2C connection
654
}
755

856
void loop() {
9-
nicla::leds.setColor(green);
10-
delay(1000);
11-
nicla::leds.setColor(off);
12-
delay(1000);
13-
}
57+
//run this code in a loop
58+
nicla::leds.setColor(green); //turn green LED on
59+
delay(1000); //wait 1 second
60+
nicla::leds.setColor(off); //turn all LEDs off
61+
delay(1000); //wait 1 second
62+
}
63+
64+

0 commit comments

Comments
 (0)