Skip to content

Instantly share code, notes, and snippets.

@keryil
Created November 21, 2016 13:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save keryil/37974d9eea07ed9ea4949ab71507c92d to your computer and use it in GitHub Desktop.
Arduino code that mimics an RF transmitter in order to program an ESC without one.
#include <Arduino.h>
#include <Servo.h>
static const int PROP_PIN = 9;
Servo brushless;
void setup() {
Serial.begin(9600);
brushless.attach(PROP_PIN);
brushless.writeMicroseconds(2000);
}
void loop() {
if(Serial.available()) {
byte message[1];
Serial.readBytes(message, 1);
char msg = (char) *message;
if(msg == '0') {
brushless.writeMicroseconds(0);
Serial.println("MIN");
}
else if (msg == '1'){
brushless.writeMicroseconds(2000);
Serial.println("MAX");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment