Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This code is meant for controlling a SimonK ESC for a brushless motor.
- //made by: Experimentaltechnik.com
- #include <Servo.h>
- int data = 40;
- Servo SimonKESC;
- //int potiPin = A2; //connect this pin with the middle pin of a potentiometer
- //Connect the GND pins of the Arduino and the ESC.
- void setup() {
- Serial.begin(9600);
- SimonKESC.attach(9); //connect this PWM pin with the data cable of the ESC(usually white or yellow)
- //motorESC.write(40); //if your ESC doesn`t have the SimonK firmware you can try this; remove the //signs
- }
- void loop() {
- if (Serial.available()) {
- data = Serial.parseInt();
- SimonKESC.write(map(data, 0, 1023, 0, 179));
- }
- Serial.println(map(data, 0, 1023, 0, 179));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement