Skip to content

Instantly share code, notes, and snippets.

@xd2
Created March 4, 2021 21:39
Show Gist options
  • Save xd2/a067a7a44128b99b558fbe6158cf95d4 to your computer and use it in GitHub Desktop.
Save xd2/a067a7a44128b99b558fbe6158cf95d4 to your computer and use it in GitHub Desktop.
Arduino starter for es200
#include <Arduino.h>
int powerPin = 5;
byte messageA[] = {0xA6, 0x12, 0x02, 0x10, 0x14, 0xCF}; // BLANK CODE?
byte messageB[] = {0xA6, 0x12, 0x02, 0x01, 0x14, 0xE7}; // ESC ON & MPH
byte messageC[] = {0xA6, 0x12, 0x02, 0X05, 0x14, 0xDC}; // LIGHT ON & ESC ON & MPH
void setup() {
// initialize Serial1:
Serial.begin(9600);
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, HIGH);
Serial.write(messageA, sizeof(messageC));
delay(500);
Serial.write(messageB, sizeof(messageB));
delay(500);
}
void loop() {
Serial.write(messageC, sizeof(messageC));
delay(7000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment