yes

Files at this revision

API Documentation at this revision

Comitter:
128keaton
Date:
Mon Jun 24 01:21:15 2019 +0000
Commit message:
yes

Changed in this revision

communication.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
parameters.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 2b8bbdd96dca communication.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/communication.h	Mon Jun 24 01:21:15 2019 +0000
@@ -0,0 +1,19 @@
+#ifndef COMMUNICATION_H
+#define COMMUNICATION_H
+
+// Define the orders that can be sent and received
+enum Communication {
+  HELLO = 0,
+  RECEIVED = 1,
+  UP = 2,
+  DOWN = 3,
+  OK = 4,
+  BACK = 5,
+  POWER = 6,
+  BAD = 7,
+  ALREADY_CONNECTED = 8
+};
+
+typedef enum Communication Communication;
+
+#endif
\ No newline at end of file
diff -r 000000000000 -r 2b8bbdd96dca main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 24 01:21:15 2019 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"              
+ 
+#include "communication.h"
+#include "parameters.h"
+
+bool is_connected = false; ///< True if the connection with the master is available
+bool has_setup = false;
+
+Serial pc(USBTX, USBRX);
+
+Communication read_comm() {
+  return (Communication) Serial.read();
+}
+
+int main() {
+    if (!has_setup) {
+        setup();   
+    }  
+}
+
+int setup() {
+    has_setup = !has_setup
+        
+}
\ No newline at end of file
diff -r 000000000000 -r 2b8bbdd96dca parameters.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parameters.h	Mon Jun 24 01:21:15 2019 +0000
@@ -0,0 +1,19 @@
+#ifndef PARAMETERS_H
+#define PARAMETERS_H
+
+#define SERIAL_BAUD 115200  // Baudrate
+
+#define UP_BUTTON_PIN 11
+#define DOWN_BUTTON_PIN 12
+
+#define BUTTON_DELAY 45
+
+#define UP_TEST_PIN 2
+#define DOWN_TEST_PIN 3
+
+#define LED_PIN 13
+
+// If DEBUG is set to true, the arduino will send back all the received messages
+#define DEBUG true
+
+#endif
\ No newline at end of file