Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Repo_Noeud_Mobile by
Diff: main.cpp
- Revision:
- 16:982409595a7a
- Parent:
- 3:a77d02cb5694
--- a/main.cpp Thu Mar 05 19:06:24 2015 +0000 +++ b/main.cpp Sat Mar 21 17:19:51 2015 +0000 @@ -9,6 +9,7 @@ #include "FlexSensor.h" #include "CountDown.h" #include "Cible.h" +#include "ConsolePrint.h" #define GO 0x01 @@ -18,15 +19,16 @@ void gunner(void const* args); void rps(void const* args); void airGuitar(void const* args); +void ReadThread(void const* args); -FlexSensor index(DIGITAL, p15); // flex sensor 1. -FlexSensor majeur(DIGITAL, p16); // flex sensor 2. -FlexSensor annulaire(DIGITAL, p17); // flex sensor 3. CountDown countDown; - +Serial pc(USBTX, USBRX); // tx, rx Thread* gunner_thread_ptr = NULL; Thread* rps_thread_ptr = NULL; Thread* airguitar_thread_ptr = NULL; +Thread* IndexReadThreadPtr = NULL; +Thread* MajeurReadThreadPtr = NULL; +Thread* AnnulaireReadThreadPtr = NULL; int main(void const* args) { @@ -47,20 +49,37 @@ } } +void ReadThread(void const* args) +{ + FlexSensor flex = *(FlexSensor *) args; + flex.Run(); +} + void gunner(void const* args) { // local variables - Cible* cible = new Cible(); + //Cible* cible = new Cible(); + + unsigned int indexValue; + FlexSensor index(p15); // flex sensor 1. + FlexSensor majeur(p16); // flex sensor 2. + FlexSensor annulaire(p17); // flex sensor 3. + + IndexReadThreadPtr = new Thread(ReadThread, &index); + MajeurReadThreadPtr = new Thread(ReadThread, &majeur); + AnnulaireReadThreadPtr = new Thread(ReadThread, &annulaire); + countDown.run(); while(true) { - // Thread::signal_wait(GO); - cible->reset(); - int target = rand() % 3; + pc.printf("index value : %#04x\r\n",indexValue); + //Thread::signal_wait(GO); + //cible->reset(); + //int target = rand() % 3; - cible->set(target); - countDown.run(); + //cible->set(target); + //countDown.run(); } }