OX V1
Dependencies: mbed
Diff: main.cpp
- Revision:
- 1:6514e03fe62f
- Parent:
- 0:6182212860fb
--- a/main.cpp Mon Dec 05 15:55:28 2016 +0000 +++ b/main.cpp Mon Dec 05 16:10:29 2016 +0000 @@ -4,6 +4,7 @@ #include "Latrix.h" #include "zmu9250.h" #include "MPU9250.h" +#include "time.h" InterruptIn lim(PinName D3); InterruptIn rotate(PinName D4); @@ -19,25 +20,25 @@ bmuimu imu; Latrix ledMatrix; -Time t; +Timer t; -bool anach = false; -bool buttonState = {0,0,0}; // button limit switchm rotate and choose state respectively. -unsigned int count = 10; // count down. +bool anach ; +bool buttonState ; // button limit switchm rotate and choose state respectively. +unsigned int count; // count down. char data[50]; char elem; -bool error = false; // store error in ambigous imu data. -int helperRoll = 0, helperPitch=0,helperYaw=0; -unsigned int indx = 0; -unsigned int state = 0; +bool error ; // store error in ambigous imu data. +int helperRoll , helperPitch,helperYaw; +unsigned int indx ; +unsigned int state ; // state 0 = initial / start. // 1 = waiting for limit switch. -unsigned int turn = 0; // turn. +unsigned int turn ; // turn. -unsigned int x = 0, y = 0, z = 0,lx=0,ly=0,lz=0; -int winStatus = 0; +unsigned int x , y , z ,lx,ly,lz; +int winStatus ; void Rise(int but) { @@ -191,13 +192,25 @@ } int main()// main program of -{ +{ + anach = false; + buttonState = {0,0,0}; + count = 10; + error = false; + indx = 0 + helperRoll = 0 + state = 0; + winStatus = 0; + turn = 0; + helperPitch=0,helperYaw=0; + lim.rise(&Rise(3)); lim.fall(&Fall(3)); rotate.rise(&Rise(4)); rotate.fall(&Fall(4)); choose.rise(&Rise(5)); choose.fall(&Fall(5)); + x = 0, y = 0, z = 0,lx=0,ly=0,lz=0; ledMatrix.Initial(); // set initial pattern in led matrix. wait(5); // wait 5 second for putting the box down to set initial position of imu.