My final year project
Dependencies: BSP_DISCO_F746NG F746_GUI LCD_DISCO_F746NG SDFileSystem TS_DISCO_F746NG ResistiveTouchController Map CYS8218Controller MedianFilter
Diff: main.cpp
- Revision:
- 41:204e2788fb46
- Parent:
- 39:7bb23ad4bf87
- Child:
- 42:29ce1ff3b220
--- a/main.cpp Sat Oct 08 17:24:22 2016 +0000 +++ b/main.cpp Sat Oct 08 19:30:36 2016 +0200 @@ -1,7 +1,8 @@ #include "mbed.h" #include "Screens.hpp" +#include "ResistiveTouchController.hpp" - +//--- Function Prototypes void GUIThread(); void Init(); @@ -9,26 +10,38 @@ void Manual(); void Automatic(); void Calibrate(); +//----------------------- +//-- GUI Thread Variables and Objects int currentScreen = 0; int nextScreen = 0; Thread guiThread; Screen *activeScreen = NULL; +//---------------------------------- +//-- X Axis variables float zeroAlpha = 0; float alpha = 0; float xSP = -20; float x = 0; +//-- Y Axis Variables float zeroBeta = 0; float beta = 0; float ySP = 50; float y = 0; + +//-- Controller Variables float P = 0; float I = 0; float D = 0; float Ts = 4; +//----------------------- + + +//-- Sensors and Actuator objects +ResistiveTouchController plate(A0,A1,A3,A4,A5); float tCal[3][2]; int calPoint = 0; @@ -81,7 +94,7 @@ if( nextScreen != currentScreen ) { Thread::wait(100); - + if( activeScreen != NULL) delete activeScreen; @@ -172,8 +185,15 @@ void Automatic() { //TODO Add automatic control mode logic - ballOnPlate = test.read(); - Thread::wait(4); + ballOnPlate = plate.ToucheDetected(); + + if( ballOnPlate ) + { + plate.Measure(); + x = plate.X(); + y = plate.Y(); + } + } void Calibrate()