Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Blink
- Turns on an LED on for one second, then off for one second, repeatedly.
- This example code is in the public domain.
- */
- // Pin 13 has an LED connected on most Arduino boards.
- // give it a name:
- int led = 13;
- int del[100];
- int i = 0;
- boolean sviesa = true;
- // the setup routine runs once when you press reset:
- void setup() {
- // initialize the digital pin as an output.
- pinMode(led, OUTPUT);
- del[0] = 1000;
- del[1] = 900;
- del[2] = 800;
- del[3] = 700;
- del[4] = 600;
- del[5] = 500;
- del[6] = 400;
- del[7] = 300;
- del[8] = 200;
- del[9] = 100;
- }
- // the loop routine runs over and over again forever:
- void loop() {
- i = i + 1;
- if( i == 10)
- i = 0;
- digitalWrite(led, sviesa); // turn the LED on (HIGH is the voltage level)
- if(sviesa == true)
- {
- sviesa = false;
- delay(del[i]);
- }
- else
- {
- sviesa = true;
- delay(del[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement