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

Blink = Dim LED
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Blink = Dim LED

by kplangre on Mon Jun 01, 2020 5:19 pm

So I have a Adafruit Feather M0 Wifi and was able to get the Normal Blink script to work but when I modified it to blink my own LED off pin #11 instead of using the onboard LED, my LED barely lights up. If I connect the wire to the 3.3v pin it lights up bright. I am using a 220 Resistor with the LED.

I also tried other pin numbers with the same LED issue. when I check the voltage from the pin it is giving me a reading of about 2.9 voltage

any thoughts

kplangre
 
Posts: 5
Joined: Sun Feb 17, 2019 5:53 pm

Re: Blink = Dim LED

by adafruit_support_bill on Mon Jun 01, 2020 6:27 pm

What color LED are you using?

Also, please post your modified code.

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

Re: Blink = Dim LED

by kplangre on Tue Jun 02, 2020 1:48 pm

I tried red and yellow.

I don't think it is the led itself as when I connect it to the 3.3v pin it works fine.

I have tried pin 10 in this example.

Code: Select all | TOGGLE FULL SIZE
/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(10, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(10, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(10, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
Attachments
Blink.ino
(1.21 KiB) Downloaded 1 time
Last edited by adafruit_support_bill on Tue Jun 02, 2020 1:57 pm, edited 1 time in total.
Reason: added code in-line

kplangre
 
Posts: 5
Joined: Sun Feb 17, 2019 5:53 pm

Re: Blink = Dim LED

by adafruit_support_bill on Tue Jun 02, 2020 2:11 pm

I modified it to blink my own LED off pin #11 instead of using the onboard LED,

Your code is blinking pin 10, not 11. Make sure you are connected to the right pin.

when I check the voltage from the pin it is giving me a reading of about 2.9 voltage

Is that with or without the LED connected?

At 3.3v, a red LED in series with a 220 ohm resistor will try to draw about 9 mA. The GPIO pins on the M0 by default are limited to about 2mA, so the voltage would likely sag a bit. It is possible to configure the pins for high output mode (7mA). See the last post in this thread: https://forum.arduino.cc/index.php?topic=420879.0

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

Re: Blink = Dim LED

by kplangre on Wed Jun 03, 2020 4:16 pm

Regarding your question about which pin I was using, 10 or 11, I have tried both and changed the value in the script.

I didn't realize that the Pin's where running at a lower amperage which explains what I was seeing.

I added the following to my script:
PORT->Group[g_APinDescription[10].ulPort].PINCFG[g_APinDesciption[10].ulPin].bit.DRVSTR = 1;


And now the light is blinking bright but I have a couple more questions:
if I only set high amp on pin 10 then why do the other pins seem to be also now set at the higher amperage. I say that because no matter what pin I put/assign the LED two it is now always displaying brightly.

And if I wanted to swhich the pin back to low amperage what is the script to do that?

Thanks,
Keith

kplangre
 
Posts: 5
Joined: Sun Feb 17, 2019 5:53 pm

Re: Blink = Dim LED

by adafruit_support_bill on Wed Jun 03, 2020 4:44 pm

To revert to low-strength mode, set the DRVSTR value to 0.

The drive-strength configuration should only apply to the specified pin. Not sure why you are seeing a change on other pins.

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

Please be positive and constructive with your questions and comments.