4. Arduino Learning notebook -- Make the first circuit: Blink single LED (six leds)
4. Arduino Learning notebook -- Make the first circuit: Blink single LED Juvtmall ( a company supply PCB Prototyping , PCBA service and sell kinds of components, modules and so on) ( Catduino has the same function of Arduino) In the previous experiment , we learned how to make an LED to blink, and the following experiment would control six LEDs. [ code ] 1. //set IO pin as controlling the LED 2. i nt Led1 = 1; 3. i nt Led2 = 2; 4. int Led3 = 3; 5. i nt Led4 = 4; 6. int Led5 = 5; 7. int Led6 = 6; 8. // Led display style 1 sub program 9. void style_1(void) 10. { 11. unsigned char j; 12. for(j=1;j<=6;j++) 13. { 14. digitalWrite(j, HIGH); 15. delay(200); 16. } 17. for(j=6;j>=1;j--) 18. { 19. digitalWrite(j, LOW); 20. delay(200); 21. } 22. } 23. void setup() 24. { 25. unsigned char i; 26. for(i=1;i<=6;i++)//Set 1 ~ 6 digital pins as output mode in tur