Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<arduinoPlatform.h>
- #include<tasks.h>
- #include<interrupts.h>
- #include<stdio.h>
- #include<serial.h>
- #include<pwm.h>
- extern serial Serial;
- #define pocetak 26
- #define kraj 33
- #define ukupno 8 // ukupan broj lampica
- #define sw2 7
- void setup()
- {
- for(int i=0;i<8;i++){
- pinMode(pocetak+i,OUTPUT);
- digitalWrite(pocetak+i,LOW); // na pocetku su sve ugasene
- }
- pinMode(sw2,INPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- int brojac=0;
- //delay(2000);
- int brzina=0;
- delay(5000); // za izbor brzine
- if(digitalRead(sw2)==HIGH) brzina=100;
- else brzina=1500;
- for(int i=0;i<8;i++){
- if(i<4){ // ako nisi dosao do polovine pali prvo 26 i 33 pa 27 i 32 ...
- digitalWrite(pocetak+brojac-1,LOW);
- digitalWrite(kraj-brojac+1,LOW);
- digitalWrite(pocetak+i,HIGH);
- digitalWrite(kraj-i,HIGH);
- brojac++;
- delay(brzina);
- }else if(i>=4){
- digitalWrite(pocetak+brojac-1,LOW);
- digitalWrite(kraj-brojac+1,LOW);
- digitalWrite(pocetak+i,HIGH);
- digitalWrite(kraj-i,HIGH);
- brojac++;
- delay(brzina);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement