zoranzoki21

Vežba 3

Dec 4th, 2020
475
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int i=0;
  2.  
  3. void setup() {
  4.   pinMode(8, INPUT);
  5.   pinMode(7, INPUT);
  6.   pinMode(3, OUTPUT);
  7. }
  8.  
  9. void loop() {
  10. if(digitalRead(8)==HIGH) {
  11.   i=i+10;
  12.   if(i>255) i=255;
  13.   }
  14. if(digitalRead(7)==HIGH) {
  15.   i=i-10;
  16.   if(i<0) i=0;
  17.   }
  18.   analogWrite(3, i);
  19.   delay(100);
  20. }
RAW Paste Data