I'm running an unmodified Trinket M0 in Arduino 2.0.1 with fresh library updates (Adafruit DotStar 1.2.1) on Windows10.
The following code uploads fine: the onboard DotStar LED cycles from Green to Violet, the onboard LED "Blinks" and the Serial.Print monitor line works. But the onboard DotStar just stays Violet.
I've tried enabling Hardware SPI by commenting out the line2 (#include <SPI.h>) and 10 and uncommenting line 11 and I get the same behavior. Another unusual thing I notice is that I must reselect the port each time I upload - and it changes from say Port9 to Port10 and back.
I see the same behavior on a different Win10 laptop with fresh Arduino 2.0.1 install.
Code: Select all
#include <Adafruit_DotStar.h>
#include <SPI.h> // software SPI
//#include <avr/power.h> // ENABLE THIS LINE FOR GEMMA OR TRINKET
// if uncommented, this gives: Compilation error: avr/power.h: No such file or directory
#define NUMPIXELS 1 // Number of LEDs in strip
#define DATAPIN 7
#define CLOCKPIN 8
Adafruit_DotStar strip(NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BRG); // software SPI
//Adafruit_DotStar strip(NUMPIXELS, DOTSTAR_BRG); // hardware SPI
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
strip.begin(); // Initialize pins for output
strip.show(); // Turn all LEDs off ASAP
}
void loop() {
Serial.println("M0");
digitalWrite(LED_BUILTIN, HIGH);
strip.setPixelColor(0, 0x00FF0000);
strip.show();
delay(200);
digitalWrite(LED_BUILTIN, LOW);
strip.setPixelColor(0, 0x0000FF00);
strip.show();
delay(200);
}