XRAD'S Need a bit of C++ code to turn off onboard dotstar

Wearable electronics: boards, conductive materials, and projects from Adafruit!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
XRAD
 
Posts: 753
Joined: Sat Nov 19, 2016 3:28 pm

XRAD'S Need a bit of C++ code to turn off onboard dotstar

Post by XRAD »

using arduino IDE and Gemma M0: I have the updated dotstar lib. I have tried several variations of dotstar control...can;t get it to turn off....tired pins 7,8 and 3,4

anyone have a tip??

this does not work and locks the USB port....

Code: Select all

#include <Adafruit_DotStar.h>
 
#define NUMPIXELS 1 // Number of LEDs in strip
 
#define DATAPIN   7//3
#define CLOCKPIN   8//4

Adafruit_DotStar strip = Adafruit_DotStar(
  NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_RGB);//or GRB


void setup() {
  strip.begin(); // Initialize pins for output
  strip.show();  // Turn all LEDs off 
}

User avatar
XRAD
 
Posts: 753
Joined: Sat Nov 19, 2016 3:28 pm

Re: XRAD'S Need a bit of C++ code to turn off onboard dotstar

Post by XRAD »

So still no luck....using the below program crashes the USB port and windows error message pops up: Last USB device not recognized (but it was just fine before using Adafruit_DotStar.h)

I am using Win 11...

I can control the Dot on itsybitsy m4...but not on the Gemma...

any thoughts??

Code: Select all

#include <Adafruit_DotStar.h>  //this is the most up to date version

#define NUMPIXELS 1 // Number of LEDs in strip

#define DATAPIN    3//purple pins colors from gemma pinout pic
#define CLOCKPIN   4

Adafruit_DotStar strip = Adafruit_DotStar(
                           NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BRG); 


void setup() {
  strip.begin(); 
  strip.setBrightness(0);
  //strip.clear();
  strip.show();  // Turn all LEDs off
}

void loop(){}

User avatar
adafruit2
 
Posts: 22111
Joined: Fri Mar 11, 2005 7:36 pm

Re: XRAD'S Need a bit of C++ code to turn off onboard dotstar

Post by adafruit2 »

what if you add a Serial.begin(115200) at the start of setup()?

User avatar
XRAD
 
Posts: 753
Joined: Sat Nov 19, 2016 3:28 pm

Re: XRAD'S Need a bit of C++ code to turn off onboard dotstar

Post by XRAD »

Ok...I tried your suggestion. No luck. And the Adafruit_Dotstar.h also crashes the USB on a known good working trinket M0....hmmmm

I do have the latest DotStart lib....
Dot Libs.jpg
Dot Libs.jpg (178.14 KiB) Viewed 165 times

Code: Select all

#include <Adafruit_DotStar.h>  

#define NUMPIXELS 1 // Number of LEDs in strip

#define DATAPIN    3//from gemma pin pic
#define CLKPIN   4

//#define DOTSTAR_DATPIN INTERNAL_DS_DATA
//#define DOTSTAR_CLKPIN INTERNAL_DS_CLK

Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DATAPIN, CLKPIN, DOTSTAR_BRG);
                           //NUMPIXELS, DOTSTAR_DATPIN, DOTSTAR_CLKPIN, DOTSTAR_BRG); 


void setup() {
  Serial.begin(115200);
  strip.begin(); // Initialize pins for output
  strip.setBrightness(0);
  strip.clear();
  strip.show();  // Turn all LEDs off
}

void loop(){}

User avatar
adafruit2
 
Posts: 22111
Joined: Fri Mar 11, 2005 7:36 pm

Re: XRAD'S Need a bit of C++ code to turn off onboard dotstar

Post by adafruit2 »

hmm cant replicate - using arduino 1.8.13 and latest BSP for gemma m0 - works just fine for us :/

Code: Select all

// An example demonstrating how to control the Adafruit Dot Star RGB LED
// included on board the ItsyBitsy M4 board.

#include <Adafruit_DotStar.h>

// There is only one pixel on the board
#define NUMPIXELS 1 

//Use these pin definitions for the ItsyBitsy M4
#define DATAPIN    3
#define CLOCKPIN   4

Adafruit_DotStar strip(NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BRG);

void setup() {
  strip.begin(); // Initialize pins for output
  strip.setBrightness(0);
  strip.show();  // Turn all LEDs off ASAP
}

void loop() {
  //rainbow(10);             // Flowing rainbow cycle along the whole strip
}

Screenshot_1.png
Screenshot_1.png (70.21 KiB) Viewed 162 times

User avatar
XRAD
 
Posts: 753
Joined: Sat Nov 19, 2016 3:28 pm

Re: XRAD'S Need a bit of C++ code to turn off onboard dotstar

Post by XRAD »

I have Arduino 1.8.19.....maybe it makes a difference....

I thought I had the newest boards module...I will check...

I was able to control the Dots with older arduino versions....

EDIT: I have the correct URL json and the boards package with all the adafruit M0 and M4 boards

EDIT2: I have AVR boards manager 1.8.5 and SAMD board manager 1.7.10

Thanks for replies!

User avatar
XRAD
 
Posts: 753
Joined: Sat Nov 19, 2016 3:28 pm

Re: XRAD'S Need a bit of C++ code to turn off onboard dotstar

Post by XRAD »

Reloaded dotstar lib. No change..still crashes my USB port and dotstar does not change color or turn off on either my trinket M0's and my Gemma M0's.....
Gemma Dot pins: 3,4
Trinket Dot pins: 7,8

But dotstar example in IDE works just fine on M4 express itsybitsy....

For now, I can just physically remove the Dot off the board to save power.....not ideal..but I know it will work..lol

Locked
Please be positive and constructive with your questions and comments.

Return to “Wearables”