halo guys,
please help me.. pleae write me sketch code for input pin for my project.. i create taillight for may motorcycle.. there will be a stop light, sign left ,sign right... i already write for hazard light pattern n it work fine..but all fail (leds not on) when stop light, sign left, sign right pressed/active/high.. i use nano..i use step down to 5v connecting arduino because it just blink evrytime i connect thought 12v to vin pin.. so please help me write a code to place before/after hazard code below.. thank you before..
const int ledPins[] = {
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
int buttonPinstop = A5;
int buttonPinleft = A6;
int buttonPinright = A7;
int buttonState = 0;
;
void setup() {
pinMode(A5. INPUT);
pinMode(A6, INPUT);
pinMode(A7, INPUT);
byte n;
for (byte i = 0; i < n; i++) {
pinMode(ledPins[i],OUTPUT);
}
byte i;
for (byte i = 2; i < 17; i++)
{
pinMode(ledPins[i],OUTPUT);
}
}
void loop () {
//running/hazard light active
led pattern/hazard 1
led pattern/hazard 2
etc...
// where and what code for A5, A6 and A7 input for stop, sign left and sign right?
//A5 stop, if high leds will blinks until it low
(leds pin 2-10 will blinking)
//A6 left, if high led chaser active from right to left
digitalwrite(14, HIGH);
delay(50);
digitalwrite(15, HIGH);
delay(50);
digitalwrite(16, HIGH);
delay(50);
digitalwrite(14, LOW);
digitalwrite(15, LOW);
digitalwrite(16, LOW);
//A7 right, if high led chaser active from left to right
digitalwrite(11, HIGH);
delay(50);
digitalwrite(12, HIGH);
delay(50);
digitalwrite(13, HIGH);
delay(50);
digitalwrite(11, LOW);
digitalwrite(12, LOW);
digitalwrite(13, LOW);
}