Demo mode

Dependencies:   BioroboticsMotorControl mbed

Fork of Demo_mode by Marie-Laure Snijders

Files at this revision

API Documentation at this revision

Comitter:
XJ
Date:
Thu Nov 01 11:56:13 2018 +0000
Parent:
1:1e67c5a527cc
Commit message:
functies aangemaakt, maar er staat nog niks in. Button library moet nog toegevoegd worden

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Nov 01 11:25:58 2018 +0000
+++ b/main.cpp	Thu Nov 01 11:56:13 2018 +0000
@@ -2,6 +2,8 @@
 #include "motor.h"
 #include "Screen.h"
 
+enum Directions {up, down, right, left};
+
 InterruptIn Button1(D2);            // Right button on interface
 InterruptIn Button2(D3);            // Left button on interface
 InterruptIn Panic_button(D8);       // Red button on interface
@@ -9,16 +11,63 @@
 Motor main_motor(D6, D7, D13, D12);
 Motor sec_motor(D5, D4, D10, D11);
 
-void ()
+void up()
+{
+if(last_state != current_state) {
+        last_state = current_state;
+        
+        screen.clear_display();
+        screen.display_state_name("Demo mode");
+        screen.get_screen_handle()->printf("         up          ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.display();
+       } 
+}
+void down()
+{
+if(last_state != current_state) {
+        last_state = current_state;
+        
+        screen.clear_display();
+        screen.display_state_name("Demo mode");
+        screen.get_screen_handle()->printf("        down         ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.display();
+       } 
+  }  
 
+void right()
+{
+if(last_state != current_state) {
+        last_state = current_state;
 
+        screen.clear_display();
+        screen.display_state_name("Demo mode");
+        screen.get_screen_handle()->printf("       right         ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.display();
+        }
+}
+void left()
+if(last_state != current_state) {
+        last_state = current_state;
+
+        screen.clear_display();
+        screen.display_state_name("Demo mode");
+        screen.get_screen_handle()->printf("        left         ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.get_screen_handle()->printf("                     ");
+        screen.display();
+        }
+}
 
 int main()
 {
     while (true) 
     {
-        screen.clear_display();
-        screen.display_state_name("Demo mode");
         
         control_goes_up = true;
         control_goes_right = true;
@@ -32,7 +81,8 @@
 
         if (p_button.is_pressed()) {                            // For panic state
         current_state = failure;}
-
+        screen.clear_display();
+        screen.display_state_name("Failure mode");
 
     }
 }
\ No newline at end of file