SHARE
TWEET

Untitled

a guest Nov 14th, 2019 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Servo.h>
  2.  
  3. Servo arm;
  4.  
  5. int ch5;
  6. int val;
  7. void setup() {
  8.   // put your setup code here, to run once:
  9.   arm.attach(9);
  10.   pinMode(10, INPUT);
  11.   Serial.begin(9600);
  12.  
  13. }
  14.  
  15. void loop() {
  16.   // put your main code here, to run repeatedly:
  17. ch5 = pulseIn(10, HIGH, 25000);
  18. val = map(ch5, 984, 1968, 0, 180);
  19. val = constrain(val, 0, 180);
  20.  
  21.   arm.write(val);
  22. delay(15);
  23.  
  24. Serial.print("Channel 5:");
  25.  
  26. Serial.println(val);
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top