Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

LED guitar fingerboard
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: LED guitar fingerboard

by adafruit_support_bill on Tue Feb 11, 2020 2:30 pm

Try just 20 and 21. You don't need the GPIO prefix.

adafruit_support_bill
 
Posts: 77819
Joined: Sat Feb 07, 2009 10:11 am

Re: LED guitar fingerboard

by Rymano on Tue Feb 11, 2020 2:47 pm

Thought I tried that first... apparently not. Upload successful but no activity with single wired dotstar. Measuring 3.3v on Vcc and DI/DO.
Last edited by Rymano on Tue Feb 11, 2020 3:01 pm, edited 1 time in total.

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Re: LED guitar fingerboard

by adafruit_support_bill on Tue Feb 11, 2020 2:58 pm

Measuring 3.3v on Vcc, DI/DO and CI/CO.

I would not expect to see a solid 3.3v on the clock and data lines. Those are changing signals, so you need an oscilloscope to see what is going on in detail. With a multimeter, you will typically see some average voltage between 0v and 3.3v.

Can you post the code that you are using?

adafruit_support_bill
 
Posts: 77819
Joined: Sat Feb 07, 2009 10:11 am

Re: LED guitar fingerboard

by Rymano on Tue Feb 11, 2020 3:08 pm

Corrected my previous post after your reply; no CI/CO voltage. Just DI/DO as expected. And no problems uploading since your advice. The on-board dotstar shuts and stays off after uploading (not sure if that matters). Also chained an additional dotstar from DO/CO

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_DotStar.h>
// Because conditional #includes don't work w/Arduino sketches...
#include <SPI.h>         // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET
//#include <avr/power.h> // ENABLE THIS LINE FOR GEMMA OR TRINKET

#define NUMPIXELS 2 // Number of LEDs in strip

// Here's how to control the LEDs from any two pins:
#define DATAPIN    20
#define CLOCKPIN   21
Adafruit_DotStar strip(NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BRG);
// The last parameter is optional -- this is the color data order of the
// DotStar strip, which has changed over time in different production runs.
// Your code just uses R,G,B colors, the library then reassigns as needed.
// Default is DOTSTAR_BRG, so change this if you have an earlier strip.

// Hardware SPI is a little faster, but must be wired to specific pins
// (Arduino Uno = pin 11 for data, 13 for clock, other boards are different).
//Adafruit_DotStar strip(NUMPIXELS, DOTSTAR_BRG);

void setup() {

#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L)
  clock_prescale_set(clock_div_1); // Enable 16 MHz on Trinket
#endif

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

// Runs 10 LEDs at a time along strip, cycling through red, green and blue.
// This requires about 200 mA for all the 'on' pixels + 1 mA per 'off' pixel.

int      head  = 0, tail = -10; // Index of first 'on' and 'off' pixels
uint32_t color = 0xFF0000;      // 'On' color (starts red)

void loop() {

  strip.setPixelColor(head, color); // 'On' pixel at head
  strip.setPixelColor(tail, 0);     // 'Off' pixel at tail
  strip.show();                     // Refresh strip
  delay(20);                        // Pause 20 milliseconds (~50 FPS)

  if(++head >= NUMPIXELS) {         // Increment head index.  Off end of strip?
    head = 0;                       //  Yes, reset head index to start
    if((color >>= 8) == 0)          //  Next color (R->G->B) ... past blue now?
      color = 0xFF0000;             //   Yes, reset to red
  }
  if(++tail >= NUMPIXELS) tail = 0; // Increment, reset tail index
}
Last edited by adafruit_support_bill on Tue Feb 11, 2020 3:13 pm, edited 1 time in total.
Reason: Please use [code] tags when submitting code to the forums

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Re: LED guitar fingerboard

by Rymano on Tue Feb 11, 2020 3:18 pm

Thank you. Still learning the platform and etiquette of all this...

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Re: LED guitar fingerboard

by adafruit_support_bill on Tue Feb 11, 2020 3:46 pm

no CI/CO voltage. Just DI/DO as expected.

You should probably see something on both CI and DI. Just not a full 3.3v.

adafruit_support_bill
 
Posts: 77819
Joined: Sat Feb 07, 2009 10:11 am

Re: LED guitar fingerboard

by Rymano on Tue Feb 11, 2020 4:01 pm

CI does show a small fluctuating current

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Re: LED guitar fingerboard

by adafruit_support_bill on Tue Feb 11, 2020 4:11 pm

One more thing to try before assuming a dead pixel: Try powering the pixel from the USB (5v) pin instead of the 3.3v pin.

Also a note about safe handling of pixels. In addition to taking care to avoid static discharges, you should be sure to disconnect all power to your circuit before connecting or disconnecting wires to the pixel.

adafruit_support_bill
 
Posts: 77819
Joined: Sat Feb 07, 2009 10:11 am

Re: LED guitar fingerboard

by Rymano on Tue Feb 11, 2020 4:31 pm

Now recieving 5v on dotstars but no light. Still a little curious why the onboard dotstar remains off after uploading code. I feel there's something I missed in the initial setup of the Featherboard when following the adafruit programming tutorials.

Only when I reprogram the firmware does it return to its normal state (green light on) and Circuitpy (F:) reappears in my drive.

Thanks again for walking me through this. A humble woodworker does not a programmer make.

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Re: LED guitar fingerboard

by adafruit_support_bill on Tue Feb 11, 2020 5:31 pm

Still a little curious why the onboard dotstar remains off after uploading code. I feel there's something I missed in the initial setup of the Featherboard when following the adafruit programming tutorials.

The on-board pixel is a Neopixel. Similar to a Dotstar, but uses only one pin for communication. The default loaded CircuitPython firmware uses the Neopixel. The STM32 bootloader does not.

I don't see any obvious problems with your setup or code. The STM32F405 is a fairly new processor to the Arduino environment, so there might be some lingering issues with library support. I don't have one here to test with, but I will check with some of the other engineers.

adafruit_support_bill
 
Posts: 77819
Joined: Sat Feb 07, 2009 10:11 am

Re: LED guitar fingerboard

by Rymano on Tue Feb 11, 2020 6:01 pm

Thank you

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Re: LED guitar fingerboard

by adafruit2 on Wed Feb 12, 2020 12:00 am

rym - are you trying to upload arduino code or circuitpython code?
have you completed this test? are you able to run Blink on the f405?
https://learn.adafruit.com/adafruit-stm ... -ide-setup

note - the stm32f405 is not an easy processor to use - not recommended for beginners - is there a reason you're using it?

adafruit2
Site Admin
 
Posts: 19217
Joined: Fri Mar 11, 2005 7:36 pm

Re: LED guitar fingerboard

by Rymano on Wed Feb 12, 2020 7:25 pm

note - the stm32f405 is not an easy processor to use - not recommended for beginners - is there a reason you're using it?
That is a very good question indeed. I had no idea what I was getting into with the stm-series. I thought the bluetooth connectivity and battery input looked useful for my needs. Didn't take long to realize I was out of my league.

I plan to switch my simple project over to my itsybitsy nRF52 with battery backpack once I have it programmed. Although I will heed any advice you have for a better unit to mess with.

rym - are you trying to upload arduino code or circuitpython code?

Ive successfully loaded "blink," to the feather via circuitpython but only used ArduinoIDE with "dotstar-strandtest." IDE prompts "Start operation achieved successfully," after each load but still no light show. Was going to see if there was a basic CP code to run dotstar strandtest since its the only programmer I've had any luck with.

Thanks again.

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Re: LED guitar fingerboard

by adafruit2 on Wed Feb 12, 2020 9:44 pm

yep circuitpython will be easier!
try
https://learn.adafruit.com/adafruit-dot ... cuitpython

adafruit2
Site Admin
 
Posts: 19217
Joined: Fri Mar 11, 2005 7:36 pm

Re: LED guitar fingerboard

by Rymano on Fri Feb 14, 2020 6:44 pm

So I swapped over to itsybitsy nRF52804 and trying strandtest with Circuitpython. Seems to load fine but still no lights. Thought I had the correct DO(8)/CO(6) pins but perhaps not. Sorry I haven't swapped the Vcc wire to red yet. It's still the DI as of now with yellow for Vcc. All still receiving 5v.
20200214_172348.jpg
20200214_172348.jpg (198.86 KiB) Viewed 26 times


Code: Select all | TOGGLE FULL SIZE
# CircuitPython demo - Dotstar
import time
import adafruit_dotstar
import board
 
num_pixels = 2
pixels = adafruit_dotstar.DotStar(board.6, board.8, num_pixels, brightness=0.1, auto_write=False)
 
 
def wheel(pos):
    # Input a value 0 to 255 to get a color value.
    # The colours are a transition r - g - b - back to r.
    if pos < 0 or pos > 255:
        return (0, 0, 0)
    if pos < 85:
        return (255 - pos * 3, pos * 3, 0)
    if pos < 170:
        pos -= 85
        return (0, 255 - pos * 3, pos * 3)
    pos -= 170
    return (pos * 3, 0, 255 - pos * 3)
 
 
def color_fill(color, wait):
    pixels.fill(color)
    pixels.show()
    time.sleep(wait)
 
 
def slice_alternating(wait):
    pixels[::2] = [RED] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[1::2] = [ORANGE] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[::2] = [YELLOW] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[1::2] = [GREEN] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[::2] = [TEAL] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[1::2] = [CYAN] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[::2] = [BLUE] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[1::2] = [PURPLE] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[::2] = [MAGENTA] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
    pixels[1::2] = [WHITE] * (num_pixels // 2)
    pixels.show()
    time.sleep(wait)
 
 
def slice_rainbow(wait):
    pixels[::6] = [RED] * (num_pixels // 6)
    pixels.show()
    time.sleep(wait)
    pixels[1::6] = [ORANGE] * (num_pixels // 6)
    pixels.show()
    time.sleep(wait)
    pixels[2::6] = [YELLOW] * (num_pixels // 6)
    pixels.show()
    time.sleep(wait)
    pixels[3::6] = [GREEN] * (num_pixels // 6)
    pixels.show()
    time.sleep(wait)
    pixels[4::6] = [BLUE] * (num_pixels // 6)
    pixels.show()
    time.sleep(wait)
    pixels[5::6] = [PURPLE] * (num_pixels // 6)
    pixels.show()
    time.sleep(wait)
 
 
def rainbow_cycle(wait):
    for j in range(255):
        for i in range(num_pixels):
            rc_index = (i * 256 // num_pixels) + j
            pixels[i] = wheel(rc_index & 255)
        pixels.show()
        time.sleep(wait)
 
 
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
ORANGE = (255, 40, 0)
GREEN = (0, 255, 0)
TEAL = (0, 255, 120)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
MAGENTA = (255, 0, 20)
WHITE = (255, 255, 255)
 
while True:
    # Change this number to change how long it stays on each solid color.
    color_fill(RED, 0.5)
    color_fill(YELLOW, 0.5)
    color_fill(ORANGE, 0.5)
    color_fill(GREEN, 0.5)
    color_fill(TEAL, 0.5)
    color_fill(CYAN, 0.5)
    color_fill(BLUE, 0.5)
    color_fill(PURPLE, 0.5)
    color_fill(MAGENTA, 0.5)
    color_fill(WHITE, 0.5)
 
    # Increase or decrease this to speed up or slow down the animation.
    slice_alternating(0.1)
 
    color_fill(WHITE, 0.5)
 
    # Increase or decrease this to speed up or slow down the animation.
    slice_rainbow(0.1)
 
    time.sleep(0.5)
 
    # Increase this number to slow down the rainbow animation.
    rainbow_cycle(0)

Rymano
 
Posts: 22
Joined: Fri Dec 20, 2019 4:59 pm

Please be positive and constructive with your questions and comments.