Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Servo.h>
- #define SERVO 12
- #define VLEVO 16
- #define VPRAVO 17
- #define MIN 0
- #define MAX 180
- Servo mojeServo;
- void setup()
- {
- pinMode(VLEVO, INPUT_PULLUP);
- pinMode(VPRAVO, INPUT_PULLUP);
- mojeServo.attach(SERVO);
- }
- int uhel = 90;
- void loop()
- {
- if (digitalRead(VLEVO) == 0) {
- if (uhel > MIN) uhel--;
- }
- if (digitalRead(VPRAVO) == 0) {
- if (uhel < MAX) uhel++;
- }
- mojeServo.write(uhel);
- delay(20);
- }
Advertisement
Add Comment
Please, Sign In to add comment