Sorry about very-very simple question (XIAO RP2040, arduino mode)
I would like to switch on the RGB led (in BLUE color) when start my program (measurement and data collection) and switch off when the last data is collected.
Please give me an Arduino code.
Steven
Hello, here is the reference code, when you send a code to the board by serial tools, the light will change to red:
#include <Adafruit_NeoPixel.h>
int Power = 11;
int PIN = 12;
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin();
Serial.begin(9600);
pinMode(Power, OUTPUT);
digitalWrite(Power, HIGH);
pixels.show();
pixels.clear();
pixels.setPixelColor(0, pixels.Color(0, 0, 255));
}
void loop() {
pixels.show();
if (Serial.available() != 0) {
pixels.show();
pixels.clear();
pixels.setPixelColor(0, pixels.Color(255, 0, 0));
}
delay(400);
}