Where is it ? I see examples that use it but it doesn’t work on mi Xiao. Compiles OK but no flash. I see variant.h files that say 15, 13 & 6 but none flash the onboard LED. It does flash during loading & execution bur not under my control. Inquiring minds want to know.
The basic (been around forever) Arduino “Blink” example works for me with the XIAO. Could you, perhaps, show us your complete sketch?
I note that LED_BUILTIN for the Seeeduino XIAO is Arduino pin 13, which is connected to the Yellow LED.
.
I modified the “Blink” sketch a little to illustrate the active-low operation of the built-in LED.
If the sketch compiles and uploads OK but the Yellow LED doesn’t give a brief flash every second, your XIAO is defective.
/*
* Modification of the been-around-forever Arduino "Blink" example
* for boards like the Seeeduino XIAO, which have an active-low LED
* connection.
*
* Changed so that on-time is different from off-time so that the
* active-low operation can be observed.
*
* davekw7x
* July, 2022
*/
// Active-low LED connection
#define LED_ON LOW
#define LED_OFF HIGH
// The LED will flash briefly every second
#define ON_TIME 100
#define OFF_TIME 900
// For the XIAO, LED_BUILTIN is Arduino pin 13, which is connected
// to the Yellow LED
//
// You can change the following statement to another pin if you want
// to experiment.
//
int led = LED_BUILTIN; // Yellow LED
//int led = PIN_LED2; // Blue LED
//int led = PIN_LED3; // Another Blue LED (Really???)
void setup()
{
pinMode(led, OUTPUT);
} // End of setup()
void loop()
{
digitalWrite(led, LED_ON); // Turn the LED on by making the voltage LOW
delay(ON_TIME); // Wait for a tenth of a second.
digitalWrite(led, LED_OFF); // Turn the LED off by making the voltage high
delay(OFF_TIME); // Wait for a second or so
} // End of loop()
Regards,
Dave
Dave
OK solved, tried another XIAO, original has problems with its yellow/orange LED. Turns out there are at least 4 LEDs, clues are in your comments. I hadn’t seen PIN_LED2/3 called out anywhere before.
int led = LED_BUILTIN; // Yellow LED – orange on miine
int led = PIN_LED2; // Blue LED – yes
int led = PIN_LED3; // Another Blue LED (Really???) – yes
also a green one that seems on all the time, power ?
Thank you
PS, trying to write to pin 15 caused a condition where I needed a double reset to get the USB port back,