Steady Purple Light

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
wingnut18
 
Posts: 6
Joined: Sat Dec 08, 2018 2:40 pm

Steady Purple Light

Post by wingnut18 »

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.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Steady Purple Light

Post by adafruit_support_mike »

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

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

Re: Steady Purple Light

Post by wingnut18 »

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

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

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

BANNED = DigitalInOut(board.D3)
BANNED.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
        BANNED.value = False
        solenoidB.value = False
    else:
        turrets.value = False
        BANNED.value = True
        time.sleep(.2)
        turrets.value = True
        solenoidB.value = True
        time.sleep(.3)
        BANNED.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.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Steady Purple Light

Post by adafruit_support_mike »

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

User avatar
ocpBerlin
 
Posts: 34
Joined: Fri Dec 07, 2018 6:22 am

Re: Steady Purple Light

Post by ocpBerlin »

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.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Steady Purple Light

Post by adafruit_support_mike »

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

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.

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

Return to “Trinket ATTiny, Trinket M0”