the slap

Dependencies:   Encoder HIDScope MODSERIAL TextLCD mbed-dsp mbed

Fork of The_SLAP_5_1 by Daan

Revision:
2:3bf615031d7a
Parent:
1:96cd4c9c5465
Child:
3:81a6009303a9
--- a/main.cpp	Wed Oct 22 14:16:53 2014 +0000
+++ b/main.cpp	Thu Oct 23 15:03:01 2014 +0000
@@ -14,6 +14,7 @@
 #include "arm_math.h"
 #include "encoder.h"
 #include "MODSERIAL.h"
+#include "TextLCD.h"
 
 #define M2_PWM PTC8 //blauw
 #define M2_DIR PTC9 //groen
@@ -21,6 +22,8 @@
 #define M1_DIR PTA4 //kleine motor
 #define TSAMP 0.005  // Sampletijd, 200Hz
 
+TextLCD lcd(PTE5, PTE3, PTE2, PTB11, PTB10, PTB9, TextLCD::LCD16x2, NC, NC, TextLCD::HD44780); // rs, e, d4-d7 CONTROLEREN!! (Pinnen wel vrij :) )! //TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x4); // rs, e, d4-d7 ok
+
 Encoder motor2(PTD2,PTD0); //geel,wit kleine mtor
 Encoder motor1(PTD5,PTA13);//geel,wit
 PwmOut pwm_motor1(M1_PWM);
@@ -102,29 +105,34 @@
         arm_biquad_cascade_df1_init_f32(&lowpass_triceps,1 ,lowpass_const,lowpass_triceps_states);
         arm_biquad_cascade_df1_init_f32(&envelop_triceps,1 ,envelop_const,envelop_triceps_states);
         arm_biquad_cascade_df1_init_f32(&envelop_biceps,1 ,envelop_const,envelop_biceps_states);
+        
         switch(state) {
-            case RUST: {                    //Aanzetten
+            case RUST: {                        //Aanzetten
                 
                 state = KALIBRATIE;
                 break;                         
             }                               
 
-            case KALIBRATIE: {         
-                pc.printf("Kalibratie");
+            case KALIBRATIE: {
+                lc.cls();
+                lcd.locate(0,0);         
+                lcd.printf("Kalibratie");   //regel 1 LCD scherm
+                lcd.locate(0,1);
+                lcd.printf("");             //regel 2 LCD scherm
                 wait(1);   
                                               
                 state = RICHTEN;                       
-                break;                          //Stopt acties in deze case
+                break;                          
             }                               
 
-           case RICHTEN: {         //Batje richten
-           pc.printf("Richten");
+           case RICHTEN: {                   //Batje richten
+           lcd.printf("Richten");
            wait(1);
            state = SLAAN;
            break; 
             }                              
-           case SLAAN: {         //Balletje slaan
-           pc.printf("Slaan!");
+           case SLAAN: {                    //Balletje slaan
+           lcd.printf("Slaan!");
            wait(1);
            state = RICHTEN;
            break; 
@@ -132,9 +140,9 @@
 
             default: {
                 state = RUST;
-            }                               //Accolade einde default
+            }                               
 
-        }                               //Accolade einde switch
+        }                              
 
-    }                               //Accolade einde main
-    }
\ No newline at end of file
+    }                               
+}
\ No newline at end of file