Index

auto-plow / b75b51a

A wheelchair motor-propelled battery-powered ESP32-driven remote control snow plow.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
4012 Jan 2019 19:1083d2e4aUpdatesjoshuas3110N

Blob @ auto-plow / src / rpi / main.c

text/plain926 bytesdownload raw
1#include "stdio.h"
2#include "stdlib.h"
3
4int main() {
5 printf("AutoPlow starting...\n\n");
6
7 printf("Attempting to set proper device configuration on ARD1\n");
8 system("stty -F /dev/ttyACM0 9600 raw -clocal -echo");
9
10 printf("Attempting to begin serial data read on ARD1 (Motor Controller) at /dev/ttyACM0\n");
11 FILE * ttyACM0;
12 ttyACM0 = fopen("/dev/ttyACM0", "w+");
13 if (ttyACM0) {
14 printf("Successfully opened serial stream\n\n");
15 printf("Attempting device reset\n");
16 fputs("Restart;", ttyACM0);
17 printf("Dumping contents:\n");
18 char buffer[4096];
19 fputs("Brakes 0;", ttyACM0);
20 while (fgets(buffer, sizeof(buffer), ttyACM0) != NULL) {
21 printf("Input: ");
22 printf(buffer);
23 }
24 printf("Closing file stream\n");
25 fclose(ttyACM0);
26 } else {
27 printf("Unsuccessful in opening serial stream. Make sure the Arduino is plugged in to the RPI.\n");
28 return 1;
29 }
30 return 0;
31}
32