0

Steady Purple Light
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Steady Purple Light

by wingnut18 on Mon May 27, 2019 3:20 am

I have a new Trinket M0 board with updated UF2 and Default zip. Installed my code and noticed the DotStar held a steady purple light. Looked at the DotStar codes and couldn't find a definition. So I ran the demo LED blinking code in your CircuitPython tutorial and it ran fine but the purple light remained steady. Is it a new code or just a glitch in this board's programming? Thanks.

wingnut18
 
Posts: 6
Joined: Sat Dec 08, 2018 2:40 pm

Re: Steady Purple Light

by adafruit_support_mike on Tue May 28, 2019 3:47 am

Could you post the exact code you're using (between CODE tags please)?

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: Steady Purple Light

by wingnut18 on Tue May 28, 2019 11:47 am

Sure, no problem. First code is what I used to test the board, only because I knew it was a working code and simple. It gives me the steady purple light along with the blinking red LED.

Code: Select all | TOGGLE FULL SIZE
import board
import digitalio
import time

led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)


And then here is the code for my project (still a work in progress). But the board still gave me a steady purple light:

Code: Select all | TOGGLE FULL SIZE
import time
import board
from digitalio import DigitalInOut, Direction, Pull

startup = DigitalInOut(board.D0)
startup.direction = Direction.OUTPUT

trigger = DigitalInOut(board.D1)
trigger.direction = Direction.INPUT
trigger.pull = Pull.UP

turrets = DigitalInOut(board.D2)
turrets.direction = Direction.OUTPUT

solenoidA = DigitalInOut(board.D3)
solenoidA.direction = Direction.OUTPUT

solenoidB = DigitalInOut(board.D4)
solenoidB.direction = Direction.OUTPUT

time.sleep(.5)
startup.value = False
time.sleep(.1)
startup.value = True

while True:
    if trigger.value:
        turrets.value = True
        solenoidA.value = False
        solenoidB.value = False
    else:
        turrets.value = False
        solenoidA.value = True
        time.sleep(.2)
        turrets.value = True
        solenoidB.value = True
        time.sleep(.3)
        solenoidA.value = False
        time.sleep(.2)
        solenoidB.value = False

    time.sleep(5.0)


Everything appears to work fine, it's just an odd look with a steady purple light. Thanks again for the help.

wingnut18
 
Posts: 6
Joined: Sat Dec 08, 2018 2:40 pm

Re: Steady Purple Light

by adafruit_support_mike on Tue May 28, 2019 8:55 pm

The DotStar keeps doing whatever the bootloader tells it to until you tell it to do something else. By default, the bootloader sets it to purple just before handing control over to the code you've uploaded.

This post has code that shows how to change the colors of the built-in DotStar:

viewtopic.php?t=124501#p622068

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: Steady Purple Light

by ocpBerlin on Mon Jun 17, 2019 3:00 am

Is there any way to turn it off without importing the DotStar library? Space is really limited on the Trinket M0 and the DotStar library does not fit after copying the libraries I need for my project.

I tried setting both control pins to low (board.APA102_SCK and board.APA102_MOSI), but that doesn't do the trick.

ocpBerlin
 
Posts: 13
Joined: Fri Dec 07, 2018 6:22 am

Re: Steady Purple Light

by adafruit_support_mike on Wed Jun 19, 2019 1:44 am

Leaving the data and clock pins idle doesn't shut off a DotStar. It will just keep displaying the last color it was given.

You can bit-bang the signals to shut off a single DotStar easily enough though: it's the 12-byte sequence:

Code: Select all | TOGGLE FULL SIZE
0x00, 0x00, 0x00, 0x00,
0xE0, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF
The first four bytes are the 'start an update' message. The next four are the color for a sigle DotStar (the first three bits of every LED frame are high), with the RGB values all set to zero. The last four bytes are the 'end of update' message.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.