Turn off built-in DOTSTAR LED

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
hatem0
 
Posts: 4
Joined: Wed Jan 19, 2022 11:00 am

Turn off built-in DOTSTAR LED

Post by hatem0 »

Hi everyone,
I am posting inside Trinket group, but I want to ask regarding Gemma M0.
How to turn off the built-in LED DOTSTAR.
I am using Arduino IDE.

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: Turn off built-in DOTSTAR LED

Post by dastels »

For how to control dotstars see https://learn.adafruit.com/adafruit-dotstar-leds. For the pins to use on the GemmaM0 see https://learn.adafruit.com/assets/49776.

Then just set it to black (i.e. #000000).

Dave

User avatar
hatem0
 
Posts: 4
Joined: Wed Jan 19, 2022 11:00 am

Re: Turn off built-in DOTSTAR LED

Post by hatem0 »

dastels wrote:For how to control dotstars see https://learn.adafruit.com/adafruit-dotstar-leds. For the pins to use on the GemmaM0 see https://learn.adafruit.com/assets/49776.

Then just set it to black (i.e. #000000).

Dave
These links were informative, but still I am not able to turn the built-in DOTSTAR OFF.
It should be easy, but I feel shy that I can't make it works.
the DOTSTAR always showing magenta, whatever color combination I use.

Code: Select all

#include <Adafruit_DotStar.h>
#include <avr/power.h>

#define NUMPIXELS 1

Adafruit_DotStar strip(NUMPIXELS, DOTSTAR_BRG);

uint32_t color = 0x000000;

void setup() 
{
  strip.begin();
}

void loop() 
{
  strip.setPixelColor(0, color);
  strip.show();
}

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: Turn off built-in DOTSTAR LED

Post by dastels »

You're not specifying the pins for the builtin DotStar. Clock is on digital pin 4, and data is digital pin 3. E.g.:

Code: Select all

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

User avatar
hatem0
 
Posts: 4
Joined: Wed Jan 19, 2022 11:00 am

Re: Turn off built-in DOTSTAR LED

Post by hatem0 »

Thanks, it working now.
I will post the full code for reference.

Code: Select all

//Turn off built-in DOTSATR LED in Gemma M0 board.
#include <Adafruit_DotStar.h>
#include <avr/power.h>

#define NUMPIXELS 1
#define DATAPIN 3
#define CLOCKPIN 4

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

void setup() 
{
  strip.begin();
  strip.show();
}

void loop() 
{

}

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: Turn off built-in DOTSTAR LED

Post by dastels »

Excellent!

Dave

User avatar
cmj879
 
Posts: 9
Joined: Fri Sep 13, 2019 3:02 am

Re: Turn off built-in DOTSTAR LED

Post by cmj879 »

I want to turn off the DotStar on a Trinket M0. This code is not working. The program uploads, but the serial port disables. I checked the hardware with Blink and it works and the serial port remains. I'm running Windows 10 and have not installed Adafruit drivers. Just wanted to see if there is some other issue before I mess with the drivers:

Code: Select all

#include <Adafruit_DotStar.h>

#define NUMPIXELS 1 // Number of DotStar LEDs in strip
#define DATAPIN    7
#define CLOCKPIN   8

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

void setup() {

  strip.begin();
  strip.show(); // turn off the *%$*@ DotStar
  
}

void loop() {

}

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: Turn off built-in DOTSTAR LED

Post by dastels »

Does the dotstar turn off?

Dave

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

Re: Turn off built-in DOTSTAR LED

Post by XRAD »

try this, avoids pin confusion....

Code: Select all

#include <Adafruit_DotStar.h>

Adafruit_DotStar dot = Adafruit_DotStar(1, INTERNAL_DS_DATA, INTERNAL_DS_CLK, DOTSTAR_BGR);

void setup() {
 dot.begin();
 dot.show(); 
}

void loop() {
}

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

Return to “Trinket ATTiny, Trinket M0”