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.
Revision 0:1e0b34f02f01, committed 2018-02-14
- Comitter:
- YROY2004
- Date:
- Wed Feb 14 15:22:56 2018 +0000
- Commit message:
- Exemple d'initialisation variable (polymorphisme)
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/maClasseToggle.h Wed Feb 14 15:22:56 2018 +0000
@@ -0,0 +1,24 @@
+class maClasseToggle
+{
+ public:
+ maClasseToggle(void){
+ statut = 0;
+ }
+ maClasseToggle(unsigned char s):statut(s)
+ {
+
+ }
+ void toggle(void){
+ if (statut == 0){
+ statut = 1;
+ }
+ else {
+ statut = 0;
+ }
+ }
+ unsigned char retourneStatut(void){
+ return statut;
+ }
+ private:
+ unsigned char statut;
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Feb 14 15:22:56 2018 +0000
@@ -0,0 +1,21 @@
+//code dérivé du code présenté dans le document 2018-01 247-436 D-0015 M2-S4-TH (powerpoint)
+#include "mbed.h"
+#include "maClasseToggle.h"
+int main() {
+uint16_t retour;
+DigitalOut monLED(LED1);
+maClasseToggle monObjetToggle1;
+maClasseToggle monObjetToggle2(1);
+ printf("initialisation\n");
+ retour = monObjetToggle1.retourneStatut();
+ printf("statut 1: %d\n", retour);
+ retour = monObjetToggle2.retourneStatut();
+ printf("statut 2: %d\n", retour);
+ while(1) {
+ monObjetToggle1.toggle();
+ retour = monObjetToggle1.retourneStatut();
+ printf("statut 1: %d\n", retour);
+ monLED = retour;
+ wait(1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Feb 14 15:22:56 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file