Flora PWM pins

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Flora PWM pins

Postby tektsu » Sun Feb 10, 2013 6:59 pm

What pins support PWM on the Flora? I am trying to use analogWrite(), but the pins I have tried (D9 and D11) don't seem to support it.
Thanks
tektsu
 
Posts: 18
Joined: Sun Nov 15, 2009 4:07 pm


Re: Flora PWM pins

Postby tektsu » Mon Feb 11, 2013 8:37 am

I had seen that tutorial, and it *does* say that D9 supports PWM, however, unless I am misunderstanding the code, it's doing the PWM in software, not using analogWrite(). analogWrite() does not seem to work on that pin. Is there a pin which will support analogWrite?
tektsu
 
Posts: 18
Joined: Sun Nov 15, 2009 4:07 pm

Re: Flora PWM pins

Postby adafruit_support_bill » Mon Feb 11, 2013 9:15 am

The 32U4 does have hardware PWM. Not sure why analogWrite wouldn't work. I'll look into it.
User avatar
adafruit_support_bill
 
Posts: 15898
Joined: Sat Feb 07, 2009 9:11 am

Re: Flora PWM pins

Postby adafruit » Mon Feb 11, 2013 10:39 am

Try this? its our flora analog output test code :)

Code: Select all
void setup() {
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

  analogWrite(6, 66);
  analogWrite(9, 128);
  analogWrite(10, 194);
}


void loop() {
  delay(100);
}
User avatar
adafruit
 
Posts: 10483
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Flora PWM pins

Postby tektsu » Mon Feb 11, 2013 11:26 am

I will give it a try this evening when I get home, and I'll let you know the results.
Thanks
tektsu
 
Posts: 18
Joined: Sun Nov 15, 2009 4:07 pm

Re: Flora PWM pins

Postby tektsu » Mon Feb 11, 2013 6:15 pm

I hooked up LEDs and resistors to the pins 6, 9 and 10. I used the same kind of LEDs from the same package, so they should be similar, and I used the same value resistor for each LED. Using your sample program, all three LEDs come on and appear to be the same brightness.

However, using the following code, I can see that there is a slight difference between the three, although the one set at 194 does not appear to blink.

Code: Select all
void setup() {
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
}


void loop() {
  analogWrite(6, 66);
  analogWrite(9, 128);
  analogWrite(10, 194);
  delay(500);
  digitalWrite(6, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(10, HIGH);
  delay(500);
}


So apparently the PWM is working, but perhaps the duty cycle is not as expected.

I recently moved, and of course I can't find my o-scope probes now. :( I'll pick up a new set when I get into town and see if I can see what's up.

Thanks for your help.
tektsu
 
Posts: 18
Joined: Sun Nov 15, 2009 4:07 pm

Re: Flora PWM pins

Postby adafruit_support_bill » Mon Feb 11, 2013 6:25 pm

LED response in general is not linear. For most of them, you need to reduce the duty cycle considerably before it visibly dims. I wouldn't expect 194 to be much different than 255.
User avatar
adafruit_support_bill
 
Posts: 15898
Joined: Sat Feb 07, 2009 9:11 am

Re: Flora PWM pins

Postby tektsu » Tue Feb 12, 2013 8:43 am

Yep, further testing shows everything is working as it should. Thanks for your help!
tektsu
 
Posts: 18
Joined: Sun Nov 15, 2009 4:07 pm


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: No registered users and 0 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]