Add identification logic to camera firmware

This allows the Electron client to query the each Arduino and properly
assign each serial port to their function.
This commit is contained in:
Matt 2016-05-12 23:10:44 -04:00
parent 408c0beb61
commit 1a116261a6
1 changed files with 10 additions and 0 deletions

View File

@ -41,6 +41,9 @@ const char cmd_cam_backward = 'f';
const char cmd_debug = 'd'; const char cmd_debug = 'd';
const char cmd_connect = 'i'; const char cmd_connect = 'i';
volatile char cmd_char = 'z'; volatile char cmd_char = 'z';
const char cmd_mcopy_identifier = 'm';
const char cmd_cam_identifier = 'k';
const int serialDelay = 5; const int serialDelay = 5;
void setup() { void setup() {
@ -72,6 +75,8 @@ void cmd (char val) {
debug(); debug();
} else if (val == cmd_connect) { } else if (val == cmd_connect) {
connect(); connect();
} else if (val == cmd_mcopy_identifier) {
identify();
} else if (val == cmd_camera) { } else if (val == cmd_camera) {
Frame(); Frame();
} else if (val == cmd_cam_forward) { } else if (val == cmd_cam_forward) {
@ -92,6 +97,11 @@ void connect () {
log("connect()"); log("connect()");
} }
void identify () {
Serial.println(cmd_cam_identifier);
log("identify()");
}
void Pins_init () { void Pins_init () {
pinMode(PIN_MOTOR_FORWARD, OUTPUT); pinMode(PIN_MOTOR_FORWARD, OUTPUT);
pinMode(PIN_MOTOR_BACKWARD, OUTPUT); pinMode(PIN_MOTOR_BACKWARD, OUTPUT);