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
main.cpp
- Committer:
- groygirard
- Date:
- 2015-03-05
- Revision:
- 7:ce6e58c5a119
- Parent:
- 5:2b539028e5a9
- Parent:
- 6:fd1bf5563299
- Child:
- 8:51f6c8f59449
File content as of revision 7:ce6e58c5a119:
/* S5 Projet - Conception d'un systeme embarque reseaute * main.cpp * * @author Equipe de projet 2 * */ // System libraries #include "mbed.h" #include "rtos.h" // Proprietary libraries #include "CountDown.h" #include "FlexSensor.h" <<<<<<< local #include "CountDown.h" #include "Cible.h" ======= #include "MMA8452Q.h" >>>>>>> other #define GO 0x01 enum GameMode { GUNNER, RPS, AirGuitar}; //PROTOTYPES DE FONCTION void gunner(void const* args); void rps(void const* args); void airGuitar(void const* args); void accelTesting(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; Accel accel; Thread* gunner_thread_ptr = NULL; // Possiblement mettre dans un tableau Thread* rps_thread_ptr = NULL; // avec des position codees Thread* airguitar_thread_ptr = NULL; // dans des define. guillaume int main(void const* args) { <<<<<<< local GameMode mode(GUNNER); switch(mode) { ======= // Initializing the accelerometer accel = Accel(); accel.init_MMA8452(); RtosTimer sync(accelTesting, osTimerPeriodic, (void *)0); GameMode mode = GUNNER; countDown.run(); switch(mode) { >>>>>>> other case GUNNER: gunner_thread_ptr = new Thread(gunner); break; case RPS: rps_thread_ptr = new Thread(rps); break; case AirGuitar: airguitar_thread_ptr = new Thread(airGuitar); break; default: break; } <<<<<<< local while(1){ } ======= sync.start(250); while(1) { } >>>>>>> other } void gunner(void const* args) <<<<<<< local { // local variables Cible* cible = new Cible(); countDown.run(); while(true) { // Thread::signal_wait(GO); cible->reset(); int target = rand() % 3; cible->set(target); countDown.run(); ======= { // local variables while(true) { Thread::signal_wait(GO); // code... >>>>>>> other } } void rps(void const* args) { // local variables while(true) { Thread::signal_wait(GO); // code... } } void airGuitar(void const* args) { // local variables while(true) { Thread::signal_wait(GO); // code... } } void accelTesting(void const* args) { accel.get_axis_values(); }