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;
- #include<arduinoPlatform.h>
- #include<tasks.h>
- #include<interrupts.h>
- #include<stdio.h>
- #include<serial.h>
- #include<pwm.h>
- extern serial Serial;
- #define PIN1 2
- #define PIN2 7
- #define PIN3 8
- #define PIN4 35
- void setup()
- {
- pinMode(PIN1,INPUT);
- pinMode(PIN2,INPUT);
- pinMode(PIN3,INPUT);
- pinMode(PIN4,INPUT);
- for(int i=0;i<8;i++){
- pinMode(26+i,OUTPUT);
- }
- }
- void loop()
- {
- int brojac=0; // brojim upaljene lampice
- if(digitalRead(PIN1)) brojac+=2;
- if(digitalRead(PIN2)) brojac+=2;
- if(digitalRead(PIN3)) brojac+=2;
- if(digitalRead(PIN4)) brojac+=2;
- for(int i=0;i<brojac;i++){
- digitalWrite(26+i,HIGH);
- delay(500);
- }
- for(int i=0;i<8;i++){
- digitalWrite(26+i,LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement