Difficulty in Arduino programming on LED -


im working on arduino proramming have 1 led off on next one.. 16 leds tgt , im using shift register mc74hc595an aka 595 register. im finding difficult code them myself still learning how programme arduino. having code or work out on code share me please? form of appreciated! thank you!

here code did doesnt seem working.

    const int button0pin = 15;     const int button1pin = 1;     const int button2pin = 2;     const int button3pin = 3;     const int button4pin = 4;     const int button5pin = 5;     const int button6pin = 6;     const int button7pin = 7;        void setup() {       // put setup code here, run once:     pinmode(button0pin, output);     pinmode(button1pin, output);     pinmode(button2pin, output);     pinmode(button3pin, output);     pinmode(button4pin, output);     pinmode(button5pin, output);     pinmode(button6pin, output);     pinmode(button7pin, output);     pinmode(14, input);      serial.begin(9600);      }      void loop() {       // put main code here, run repeatedly:        digitalwrite(button0pin, 0);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     delay(5000);      digitalwrite(button0pin, 0);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 1);     delay(5000);      digitalwrite(button0pin, 0);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 1);     digitalwrite(button2pin, 0);     delay(5000);      digitalwrite(button0pin, 0);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 1);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     delay(5000);      digitalwrite(button0pin, 0);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 1);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     delay(5000);      digitalwrite(button0pin, 0);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 1);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     delay(5000);      digitalwrite(button0pin, 0);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 1);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     delay(5000);      digitalwrite(button0pin, 0);     digitalwrite(button1pin, 1);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     delay(5000);      digitalwrite(button0pin, 1);     digitalwrite(button1pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     digitalwrite(button2pin, 0);     delay(5000);     } 

so, clear here, initializing pin 14 receive input, never use in main loop check if getting input.

to make life easier, consider naming pins shorter names. instead of "button0pin" how "b0"?

also, may want try using loop instead of doing (writing out separate blocks of code, each output of 1 pin @ different spot)

you can read arduino reference guides (i read every time i'm programming) here: https://www.arduino.cc/en/reference/homepage

and link: https://electronics.stackexchange.com/questions/17975/arduino-uno-light-leds-right-to-left-and-then-reversed may similar loop you're needing.

hope helped, @ least little bit.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo