-
-
Notifications
You must be signed in to change notification settings - Fork 213
[TC-442][TC-443] Prevent mis-use of Blink_Nicla.ino sketch with Nicla Vision board #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
facchinm
merged 3 commits into
arduino:master
from
aliphys:aliphys/BlinkNiclaSense-CommentsAndError
Feb 6, 2023
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
67 changes: 59 additions & 8 deletions
67
libraries/Nicla_System/examples/Blink_Nicla/Blink_Nicla.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,64 @@ | ||
#include "Nicla_System.h" | ||
/* | ||
Blink for Nicla Sense ME | ||
|
||
Turns green LED on for one second, then turn it off. | ||
|
||
Most Arduino boards have a single LED connected from D13 to ground | ||
(with a current limiting resistor). In the Nicla Sense ME, the common | ||
anode RGB LED (DL1) is controlled by a RGB LED Driver (U8). | ||
The RGB LED Driver state is set via I2C by the ANNA-B112 Module (MD1). | ||
|
||
┌────────────┐ ┌────────────┐ | ||
│ ANNA-B112 │ │ RGB-Driver │ VPMID | ||
│ MD-1 │ │ U8 │ Red ─┬─ | ||
│ │ │ OUT3├────────◄──────┐ │ | ||
│ │ I2C │ │ Green│ │ | ||
│ ├──────┤ OUT2├────────◄──────┼───┘ | ||
│ │ │ │ Blue │ | ||
│ │ │ OUT1├────────◄──────┘ | ||
│ │ │ │ | ||
│ │ │ │ | ||
│ │ │ │ | ||
└────────────┘ └────────┬───┘ | ||
│ | ||
▼ | ||
|
||
All of this is abstracted via the Nicla_System.h header file. Details | ||
on use for controling RGB LED can be found at: | ||
https://docs.arduino.cc/tutorials/nicla-sense-me/cheat-sheet#rgb-led | ||
|
||
More advanced users can look at the source code at: | ||
https://github.com/arduino/ArduinoCore-mbed/blob/master/libraries/Nicla_System/src/Nicla_System.h | ||
|
||
Authors: Giulia Cioffi, Martino Facchin & Ali Jahangiri | ||
|
||
This example code is in the public domain. | ||
|
||
Last edit: 2nd February 2023 | ||
*/ | ||
|
||
//This sketch is only for the Nicla Sense ME, not the Nicla Vision | ||
#ifdef ARDUINO_NICLA_VISION | ||
#error "Run the standard Blink.ino sketch for the Nicla Vision" | ||
|
||
|
||
// Intialise library which communicates with RGB driver | ||
// Functions accessible under 'nicla' namespace | ||
#include "Nicla_System.h" | ||
|
||
|
||
void setup() { | ||
nicla::begin(); | ||
nicla::leds.begin(); | ||
//run this code once when Nicla Sense ME board turns on | ||
nicla::begin(); // initialise library | ||
nicla::leds.begin(); // Start I2C connection | ||
} | ||
|
||
void loop() { | ||
nicla::leds.setColor(green); | ||
delay(1000); | ||
nicla::leds.setColor(off); | ||
delay(1000); | ||
} | ||
//run this code in a loop | ||
nicla::leds.setColor(green); //turn green LED on | ||
delay(1000); //wait 1 second | ||
nicla::leds.setColor(off); //turn all LEDs off | ||
delay(1000); //wait 1 second | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.