lupus51
November 15, 2022, 10:08pm
1
hi all,
for a model-railsway-project with simulations of waterfall i want to check
brightness by dimming of severall LED types and dimensions.
for this 3 LED'S 3mm (older types) are to be tested at now with this code ;
/* led_ampel_analog_outputs_dim1
Dimming LEDs on PWM-pins
status=15.11.2022
*/
#include <Wire.h>
#define TRAFFIC_LIGHT_SPEED 1000
const unsigned int led_red = 5;
const unsigned int led_yellow = 6;//- 8 works, 6 not ?
const unsigned int led_green = 9;
int unsigned counter = 0;
// the setup function runs once when you press reset or power the board
void setup()
{
Serial.begin(9600);
// initialize digital pin LED_BUILTIN as an output.
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(led_green, OUTPUT);
analogWrite(led_red, 255);
delay(TRAFFIC_LIGHT_SPEED);
analogWrite(led_red, 0);
analogWrite(led_yellow, 255);
delay(TRAFFIC_LIGHT_SPEED);
analogWrite(led_yellow, 0);
analogWrite(led_green, 255);
delay(TRAFFIC_LIGHT_SPEED);
analogWrite(led_green, 0);
}
// the loop function runs over and over again forever
void loop()
{
for(counter=0;counter < 255;counter++)
{
analogWrite(led_yellow, counter);
delay(10);
}
for(counter=255;counter > 0;counter--)
{
analogWrite(led_yellow, counter);
delay(10);
}
//Serial.println(counter);
//counter++;
}
this code works fine with pins 5 (red) and 9 (green), but not with pin 6 of the arduino nano.
i replaced the nano with another , the same effect !
i have swapped wires between pins, the yellow led works with all different pins, but pin6
seems to be dead !
any suggestions ?
Have you tried a simpler sketch, like the Blink example changed to pin 6 from 13?
Hi,
I tested your code adding a "for" for red and green and it worked,
look here.
" sketch.ino - Wokwi Arduino and ESP32 Simulator "
Aha. Please post a wiring diagram and/or images of your hardware setup.
lupus51
November 15, 2022, 10:40pm
5
thanks for answers..
there is not much wiring..the LED'S are connected via 220 Ohm-resistors
between pin and ground..no further connections on other pins.
should the values of resistors higher or lower ?
the nano is driven from usb-port from PC.
pin13 is Not a PWM-pin !?
Yes, but pin 6 is a GPIO pin so you can test it as a digital pin.
We've seen people claim that here, and then it turns out they didn't do it right. Did you try reversing the polarity of the yellow LED? That is why I wanted you to do a simple test of the port. Instead you choose to speculate.
lupus51
November 15, 2022, 11:51pm
8
in detail , i have connected yellow led to pin 5 and to pin 9 : there it worked !
there is no chance of wrong polarity as all 3 led's are soldered with common
Minus pole to Ground and via singular resistor to each pin.
the nano is plugged on a shield-like-board , were wires can be inserted by jacks
using simple screw driver.
May be, there is a soldering error on pin6 ? i'll measure it..
Ah, you want to fix it yourself! Well, I can't argue with that. It's commendable.
But if you change your mind,
"The language of electronics is a schematic or circuit diagram. Long descriptions of what is connected to what are generally useless. A schematic is a drawing of what connects to what; please make one and photograph it. We don't mind if it's hand drawn, scruffy and does not use the correct symbols. Please don't post Fritzing diagrams. They may look nice but they are very easy to misinterpret"
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966#schematics-or-circuit-diagrams
Your hardware sounds a little off the beaten path, so images would help. Actually in this case, it would probably cut to the chase.
lupus51
November 16, 2022, 7:34am
10
good morning,
the missing connection from the arduino-plate to jack is found as broken !
all other pins are soldered ok but pin6 not
i didnt assume that a presoldered product from the deliverer would have
a fault
..in future i should test them all before going to usage
lupus51
November 16, 2022, 8:03am
11
hi,
after refreshing the solding points, all works fine..
thanks anyways !
lupus51
November 17, 2022, 5:21am
13
good morning,
it was on the prototyping plate for the arduino..that simply connecting ardiuno
nano pin with a jack array so one can wire it simply with a screwdriver..
is that a clone ?
i guess there was a cold soldered pin i.e. pin6 here..
system
Closed
May 16, 2023, 5:21am
14
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.