Advertisement
Guest User

Untitled

a guest
Oct 29th, 2016
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1.  
  2. #include <Servo.h>
  3. Servo myservo;
  4.  
  5.  
  6. void setup() {
  7. pinMode(8, INPUT);
  8. myservo.attach(9);
  9. }
  10.  
  11. void loop() {
  12. int val = digitalRead(8);
  13.  
  14. if (val == HIGH){
  15. myservo.write(80);
  16.  
  17. }
  18. else if (val == LOW){
  19. myservo.write(138);
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement