Advertisement
Guest User

Untitled

a guest
Feb 1st, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. //This code is meant for controlling a SimonK ESC for a brushless motor.
  2. //made by: Experimentaltechnik.com
  3.  
  4. #include <Servo.h>
  5. int data = 40;
  6. Servo SimonKESC;
  7. //int potiPin = A2; //connect this pin with the middle pin of a potentiometer
  8.  
  9. //Connect the GND pins of the Arduino and the ESC.
  10.  
  11. void setup() {
  12.   Serial.begin(9600);
  13.   SimonKESC.attach(9); //connect this PWM pin with the data cable of the ESC(usually white or yellow)
  14.   //motorESC.write(40); //if your ESC doesn`t have the SimonK firmware you can try this; remove the //signs
  15. }
  16.  
  17. void loop() {
  18.  
  19.   if (Serial.available()) {
  20.     data = Serial.parseInt();
  21.     SimonKESC.write(map(data, 0, 1023, 0, 179));
  22.   }
  23.   Serial.println(map(data, 0, 1023, 0, 179));
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement