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.
Exo1.cpp
- Committer:
- Agachon
- Date:
- 2021-11-10
- Revision:
- 7:e906470d40b9
- Parent:
- 6:69101b9b0c17
File content as of revision 7:e906470d40b9:
#define Exo1 #ifdef Exo1 #include "mbed.h" #include "info1.h" #define LOW 0 #define HIGH 1 //pour le debug (printf & scanf) Serial pc(USBTX, USBRX); int main(void) { //Declaration des variables : int etat; int bp; PwmOut led(LED_BLUE); //Initialisation etat=0; led.period_us(100); //Boucle infinie while (1) { //Lecture du slider (bp=1 si doigt sur slider, 0 sinon) appui_num(&bp); //Determination de l'etat en fonction de BP switch(etat) { case 0: if (bp==HIGH) { etat =1; } break; case 1: if (bp==LOW) { etat =2; } break; case 2: if (bp==HIGH) { etat =3; } break; case 3: if (bp==LOW) { etat =0; } break; } //Ecriture sur les sorties en fct de l'etat switch(etat) { case 0: led=1; break; case 1: led=1; break; case 2: led=0; break; case 3: led=0; break; } wait_ms(10); } } #endif