How to write a C Program to Blinking faster in C Programming Language ?
Solution:
- /* Blinking faster*/
- //int delayTime = 250;
- int startBlinkTime = 1000;
- int i;
- void setup()
- {
- pinMode(1,OUTPUT);
- pinMode(2,OUTPUT);
- pinMode(3,OUTPUT);
- pinMode(4,OUTPUT);
- pinMode(5,OUTPUT);
- }
- void loop()
- {
- for(i = 1; i < 9; i++){
- blinkOnce(1, startBlinkTime);
- blinkOnce(2, startBlinkTime);
- blinkOnce(3, startBlinkTime);
- blinkOnce(4, startBlinkTime);
- blinkOnce(5, startBlinkTime);
- startBlinkTime -= 100;
- }
- }
- void blinkOnce(int pinNumber, int blinkTime)
- {
- digitalWrite(pinNumber,HIGH);
- delay(blinkTime);
- digitalWrite(pinNumber,LOW);
- delay(blinkTime);
- }