From a0acfbc796ab278b86b631164c0d6d38d0f1add5 Mon Sep 17 00:00:00 2001 From: Christopher Mendez <49886387+mcmchris@users.noreply.github.com> Date: Sun, 8 Jan 2023 01:03:29 -0400 Subject: [PATCH 1/3] Update RGB LED section on Cheat-sheet Declaring the namespace as follows: "using namespace nicla;" doesn't work in the Arduino IDE, so it's necessary to name it before each statement (ex. nicla::leds.setColor(red);). Please test this by yourself and let me know if it works for you. I tested it on IDE 2.0.3 and 1.8.19 --- .../tutorials/cheat-sheet/cheat-sheet.md | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md b/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md index a3b0c5f125..94069cfd73 100644 --- a/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md +++ b/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md @@ -127,17 +127,13 @@ The Nicla System header is required to use the RGB LED. #include "Nicla_System.h" ``` -Since the functions are scoped under a specific name called "nicla", you can use the following statement to have convenient access without repeating explicitly the namespace before every function call. - -```cpp -using namespace nicla; -``` +Since the functions are scoped under a specific name called "nicla", you need to explicitly write it before each statement. The LEDs need to be started along with the Nicla inside `void setup()`: ```arduino -begin(); -leds.begin(); +nicla::begin(); +nicla::leds.begin(); ``` The LED can be set to the desired RGB value using red, green and blue components or by using one of the following predefined colors: @@ -153,9 +149,9 @@ To set the LED to a predefined color (e.g. green or blue): ```arduino void loop() { - leds.setColor(green); + nicla::leds.setColor(green); delay(1000); - leds.setColor(blue); + nicla::leds.setColor(blue); delay(1000); } ``` @@ -163,7 +159,7 @@ void loop() { To turn the LED off: ```arduino -leds.setColor(off); +nicla::leds.setColor(off); ``` You can also choose a value between 255 - 0 for each color component to set a custom color: @@ -174,13 +170,32 @@ void loop() { int green = 72; int blue = 122; - leds.setColor(red, green, blue); + nicla::leds.setColor(red, green, blue); + delay(1000); + nicla::leds.setColor(off); + delay(1000); +} +``` + +This is a complete example code to correctly control the built-in I2C LED + +```arduino +#include "Nicla_System.h" + +void setup() { + nicla::begin(); + nicla::leds.begin(); +} + +void loop() { + nicla::leds.setColor(red); delay(1000); - leds.setColor(off); + nicla::leds.setColor(off); delay(1000); } ``` + ## Sensors There are three ways to read from the on-board sensors: From e20e86cb4f55f088f2110cab43a7951c28ca087e Mon Sep 17 00:00:00 2001 From: Sebastian Romero Date: Thu, 9 Feb 2023 16:43:32 +0100 Subject: [PATCH 2/3] Update content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md --- .../boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md b/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md index 94069cfd73..4cf2776d98 100644 --- a/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md +++ b/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md @@ -177,7 +177,7 @@ void loop() { } ``` -This is a complete example code to correctly control the built-in I2C LED +This is a complete example code to blink the built-in I2C LED: ```arduino #include "Nicla_System.h" From 346e23a3033e427ca3f2b9ab048c3cbb14782bfa Mon Sep 17 00:00:00 2001 From: Sebastian Romero Date: Thu, 9 Feb 2023 16:43:42 +0100 Subject: [PATCH 3/3] Update content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md --- .../boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md b/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md index 4cf2776d98..4828da841e 100644 --- a/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md +++ b/content/hardware/06.nicla/boards/nicla-sense-me/tutorials/cheat-sheet/cheat-sheet.md @@ -127,7 +127,7 @@ The Nicla System header is required to use the RGB LED. #include "Nicla_System.h" ``` -Since the functions are scoped under a specific name called "nicla", you need to explicitly write it before each statement. +Since the functions are scoped under a specific Class name called "nicla", you need to explicitly write it before each statement. The LEDs need to be started along with the Nicla inside `void setup()`: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy