Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LED0, LED1, LED2, LED3, LED4, LED5, LED6, LED7 pin
- int pin_LED[8] = {22, 24, 26, 28, 30, 32, 34, 36};
- void setup() {
- // put your setup code here, to run once:
- for(int i=0; i<8; i++)
- {
- pinMode(pin_LED[i], OUTPUT); // LED pin Output setup
- digitalWrite(pin_LED[i], LOW); // LED pin LOW Output
- }
- }
- void loop() {
- // put your main code here, to run repeatedly:
- for(int i=0; i<256; i++)
- {
- LED_control(i); // LED control
- delay(500); // wait 0.5 second
- }
- }
- // LED contorl function
- void LED_control(uint8_t da)
- {
- for(int i=0; i<8; i++)
- {
- digitalWrite(pin_LED[i], (da >> i) & 0x1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement