for an issue there are 6 leds needed tobe switched on/off via analog pins !
i guessed that would be really simple
but 2 off the 6 leds are Not enlightened !
that are on A6 and A7 (A4,A5 are used for I2C)
have checked all leds electrically on connections and lighting, all ok !
whats wrong with the code ?
/*
check leds
*/
#define TRAFFIC_LIGHT_SPEED 500
const int led_pins_list[6] = {A0,A1,A2,A3,A6,A7};
// 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.
for(int i = 0;i < 6;i++)
{
pinMode(led_pins_list[i], OUTPUT);
}
}
// the loop function runs over and over again forever
void loop()
{
for(int i = 0;i < 6;i++)
{
analogWrite(led_pins_list[i], 255); // turn the LED on (HIGH is the voltage level)
delay(TRAFFIC_LIGHT_SPEED); // wait for a second
analogWrite(led_pins_list[i], 0); // turn the LED off by making the voltage LOW
delay(TRAFFIC_LIGHT_SPEED); // wait for a second
}
}
thanks for your info..
so i have to look for a different solution..
may be a pwm-expander over i2c i have used for servos successfully
have read in this forum that can be used for leds too..
Some PWM chips are for leds and for servo motors.
There are also libraries that can create PWM on any pin (but not on A6 and A7).
Those libraries run internally at a high frequency, it might interfere with other timing things.
If you use these diodes all six would require only one digital pin (as they can be chained) and the use of a WS2812 library and probably ease the wiring... ?!?