Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. Modified by
  2. TECHNICAL TEAM,REES52
  3.  
  4. #include <Servo.h>
  5. //Using servo library to control ESC
  6. Servo esc;
  7.  //Creating a servo class with name as esc
  8. void setup()
  9. {
  10.   esc.attach(8);
  11. //Specify the esc signal pin,Here as D8
  12.   esc.writeMicroseconds(1000);
  13.  //initialize the signal to 1000
  14.   Serial.begin(9600);
  15. }
  16. void loop()
  17. {
  18.   int val;
  19.  //Creating a variable val
  20.   val = analogRead(A0);
  21.  //Read input from analog pin a0 and store in val
  22.   val = map(val, 0, 1023, 1000, 2000); //mapping val to minimum and maximum(Change if needed)
  23.   esc.writeMicroseconds(val); //using val as the signal to esc
  24. }