Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Flora LED Sequin Adventures
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Flora LED Sequin Adventures

by eeeeeepic on Wed Apr 15, 2020 3:47 pm

Hi there! I was hoping to ask for a bit of help working with Flora. I'm a little rusty, having not programmed with it for a few years, and all my prior experience was with NeoPixels.

I've got a set of 8 LED Sequins sewn onto a jacket, and am trying to eventually send power to D10 and D12 to run each in a set of 4. I'm clearly making a mistake trying to adapt the code from the Gemma sewable hat project, though, because I'm not seeing a single (unsewn) test LED sequin light up when connected to D10 or D12 and GND; I'm also not measuring any current coming from the ports themselves. I'm hoping to make each set of lights brighten and dim on a different timer.

Is there something in this code I've missed?

Thanks! :)

Code: Select all | TOGGLE FULL SIZE
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
int counter = 0;       // counter to keep track of cycles
 
// the setup routine runs once when you press reset:
void setup()  {
  // declare pins to be an outputs:
  int led1 = 10;
  int led2 = 12;
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
}
 
// the loop routine runs over and over again forever:
void loop()  {
  // set the brightness of the analog-connected LEDs:
  analogWrite(0, brightness);
 
  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;
 
  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount;
    counter++;
  }     
  // wait for 15 milliseconds to see the dimming effect   
  delay(15);
 
// turns on the other LEDs every four times through the fade by
// checking the modulo of the counter.
// the modulo function gives you the remainder of
// the division of two numbers:
  if (counter % 4 == 0) {
    digitalWrite(2, HIGH);
  } else {
   digitalWrite(2, LOW);
  } 
}

eeeeeepic
 
Posts: 5
Joined: Mon May 14, 2018 10:36 am

Re: Flora LED Sequin Adventures

by adafruit_support_bill on Wed Apr 15, 2020 4:03 pm

Please post a photo of how you have things connected.

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

Re: Flora LED Sequin Adventures

by eeeeeepic on Wed Apr 15, 2020 5:06 pm

Hi Bill,

Please see attached. (It isn't currently powered, but this is how the cables were set up.)

IMG_20200415_165806-01.jpeg
IMG_20200415_165806-01.jpeg (159.45 KiB) Viewed 68 times


IMG_20200415_165759-01.jpeg
IMG_20200415_165759-01.jpeg (155.82 KiB) Viewed 68 times

eeeeeepic
 
Posts: 5
Joined: Mon May 14, 2018 10:36 am

Re: Flora LED Sequin Adventures

by adafruit_support_bill on Thu Apr 16, 2020 5:34 am

The connections all look OK. I think the problem is here in the code:

Code: Select all | TOGGLE FULL SIZE
  // set the brightness of the analog-connected LEDs:
  analogWrite(0, brightness);


You are writing to pin 0. If you change that to led1 or led2, that should light up your sequins,

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

Re: Flora LED Sequin Adventures

by eeeeeepic on Mon Apr 27, 2020 7:11 pm

Hi Bill!

facepalm. Yep, you were totally right! I've now managed to get to the step where I can get all 8 sequins on the jacket blinking.

I have one more question I can't seem to sort out in the code - the output from one pin (I believe 10, though I'll have to double check) slowly glows up to max brightness and then fades. The output from 12, however, goes from 0 to max to 0 again in a blinking style.

Is there somewhere in the code where I'm messing things up, or does this have to do with outputs through the ports? I'd prefer to have both outputs fade, and potentially want to play around with setting them to fade opposing each other (one set brightens, the other dims).

Thanks again!

eeeeeepic
 
Posts: 5
Joined: Mon May 14, 2018 10:36 am

Re: Flora LED Sequin Adventures

by adafruit_support_bill on Mon Apr 27, 2020 7:43 pm

Pin 12 does not have PWM capability. It can only be ON or OFF. The only pins capable of dimming are 3, 6, 9, 10 .

https://learn.adafruit.com/getting-star ... ut-diagram

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

Re: Flora LED Sequin Adventures

by eeeeeepic on Mon Apr 27, 2020 7:56 pm

Aha! I was wondering if that was the issue. Thanks!

eeeeeepic
 
Posts: 5
Joined: Mon May 14, 2018 10:36 am

Please be positive and constructive with your questions and comments.


cron