Changes between Version 3 and Version 4 of SujetTP6-2018
- Timestamp:
- Apr 6, 2018, 9:24:25 AM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SujetTP6-2018
v3 v4 26 26 - L'écran OLED 27 27 - Le capteur de lumière (cherchez-le :-) 28 - Le capteur sonore.29 28 - Le port série qui relie le module et le PC. 30 29 - Le port SPI qui relie le module au NRF … … 105 104 //--------- définition de la tache Led 106 105 107 typedefstruct Led_st {106 struct Led_st { 108 107 int timer; // numéro de timer utilisé par WaitFor 109 intperiod; // periode de clignotement108 unsigned long period; // periode de clignotement 110 109 int pin; // numéro de la broche sur laquelle est la LED 111 110 int etat; // etat interne de la led 112 } Led_t;113 114 void setup_Led( Led_t * ctx, int timer,long period, byte pin) {111 }; 112 113 void setup_Led( struct Led_st * ctx, int timer, unsigned long period, byte pin) { 115 114 ctx->timer = timer; 116 115 ctx->period = period; … … 121 120 } 122 121 123 void loop_Led( Led_t * ctx) {122 void loop_Led(struct Led_st * ctx) { 124 123 if (!waitFor(ctx->timer, ctx->period)) return; // sort s'il y a moins d'une période écoulée 125 124 digitalWrite(ctx->pin,ctx->etat); // ecriture … … 129 128 //--------- definition de la tache Mess 130 129 131 typedefstruct Mess_st {130 struct Mess_st { 132 131 int timer; // numéro de timer utilisé par WaitFor 133 intperiod; // periode d'affichage132 unsigned long period; // periode d'affichage 134 133 char mess[20]; 135 134 } Mess_t ; 136 135 137 void setup_Mess( Mess_t * ctx, int timer,long period, const char * mess) {136 void setup_Mess(struct Mess_st * ctx, int timer, unsigned long period, const char * mess) { 138 137 ctx->timer = timer; 139 138 ctx->period = period; … … 142 141 } 143 142 144 void loop_Mess( Mess_t *ctx) {143 void loop_Mess(struct Mess_st *ctx) { 145 144 if (!(waitFor(ctx->timer,ctx->period))) return; // sort s'il y a moins d'une période écoulée 146 145 Serial.println(ctx->mess); // affichage du message … … 149 148 //--------- Déclaration des tâches 150 149 151 Led_t led1;152 Mess_t mess1;150 struct Led_st Led1; 151 strucy Mess_st Mess1; 153 152 154 153 //--------- Setup et Loop