Joel Manuel Fernandez Cuyubamba / Mbed 2 deprecated Partie4

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jomfec
Date:
Mon May 02 09:05:23 2016 +0000
Commit message:
INFO2

Changed in this revision

exercice1.cpp Show annotated file Show diff for this revision Revisions of this file
exercice2.cpp Show annotated file Show diff for this revision Revisions of this file
exercice3.cpp Show annotated file Show diff for this revision Revisions of this file
exercice4.cpp Show annotated file Show diff for this revision Revisions of this file
exercice5.cpp Show annotated file Show diff for this revision Revisions of this file
exercice6.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r e54fcd358582 exercice1.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exercice1.cpp	Mon May 02 09:05:23 2016 +0000
@@ -0,0 +1,20 @@
+/*
+#include "mbed.h"
+Timer timer1; // définition du timer
+DigitalOut sortie1(p5);
+void tache1(void); // prototype de tache1
+
+int main() {
+ timer1.start(); // déclenchement du timer
+ while(1) {
+ if (timer1.read_ms()>=200)//
+ {
+ tache1(); // appel de la fonction tache1
+ timer1.reset(); // remise à zéro du timer
+ }
+ }
+}
+void tache1(){ // fonction
+ sortie1.write(!(sortie1.read())); // inversion
+} 
+*/
\ No newline at end of file
diff -r 000000000000 -r e54fcd358582 exercice2.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exercice2.cpp	Mon May 02 09:05:23 2016 +0000
@@ -0,0 +1,20 @@
+/*
+#include "mbed.h"
+Timer timer1; // définition du timer
+BusOut leds(LED4,LED3,LED2,LED1);
+int i=0;
+int main() {
+ timer1.start(); // déclenchement du timer
+ while(1) {
+        if(timer1.read()>=1)
+            {
+                i++;
+                timer1.reset();
+                if(i>=16)
+                    i=0;
+            }
+        else leds.write(i);
+           }
+           }
+         
+*/
\ No newline at end of file
diff -r 000000000000 -r e54fcd358582 exercice3.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exercice3.cpp	Mon May 02 09:05:23 2016 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h" 
+/*
+Timer timer1;
+Timer timer2; // définition des timers
+DigitalOut sortie1(p5);
+DigitalOut sortie2(p6);
+void task1(void); // prototype de tâche1
+void task2(void); // prototype de tâche2 //...
+int main() {
+ timer1.start(); // déclenchement du timer1
+ timer2.start(); // déclenchement du timer2
+ while(1) {
+ if (timer1.read_ms()>=200) // lecture du temps du timer1
+ {
+ task1(); // appel de la fonction liée au timer1
+ timer1.reset(); // remise à zéro du timer1
+ }
+ if (timer2.read_ms()>=1000) // lecture du temps du timer2
+ {
+ task2(); // appel de la fonction liée au timer2
+ timer2.reset(); // remise à zéro du timer2
+ }
+ }
+}
+// Corps des fonctions task1 et task2
+void task1(void){
+ sortie1.write(!sortie1.read()); // inversion de la sortie1
+}
+void task2(void){
+ sortie2.write(!sortie2.read()); // inversion de la sortie2
+} 
+*/
\ No newline at end of file
diff -r 000000000000 -r e54fcd358582 exercice4.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exercice4.cpp	Mon May 02 09:05:23 2016 +0000
@@ -0,0 +1,23 @@
+/*
+#include "mbed.h"
+Ticker flipper1; //déclaration du premier Ticker
+Ticker flipper2; //déclaration du deuxième Ticker
+DigitalOut sortie1(p5);
+DigitalOut sortie2(p6);
+void task1() ; //prototypes
+void task2() ;
+int main() {
+ flipper1.attach(&task1, 0.2); //task1 appelée toutes les 200ms
+ flipper2.attach(&task2, 1.0); //task2 appelée toutes les 1s
+ while(1) {
+ wait(0.2);
+ }
+}
+// Corps des fonctions task1 et task2
+void task1(void){
+ sortie1.write(!sortie1.read()); // inversion de la sortie1
+}
+void task2(void){
+ sortie2.write(!sortie2.read()); // inversion de la sortie2
+} 
+*/
\ No newline at end of file
diff -r 000000000000 -r e54fcd358582 exercice5.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exercice5.cpp	Mon May 02 09:05:23 2016 +0000
@@ -0,0 +1,16 @@
+/*
+#include "mbed.h"
+InterruptIn button(p18); // Broche 18 définie comme entrée d’interruption
+DigitalOut sortie1(p5);  //Broche 5 définie comme sortie
+void toggle(void); // prototype de la fonction toggle
+int main() {
+ button.mode(PullUp);
+ while(1){
+ button.rise(&toggle); // associe l’adresse de la fonction toggle à un front montant de la broche 18
+     }  
+}
+// Corps de la fonctions toggle (routine d'interruption)
+void toggle(void){
+ sortie1.write(!sortie1.read()); // inversion de la sortie1
+} 
+*/
\ No newline at end of file
diff -r 000000000000 -r e54fcd358582 exercice6.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exercice6.cpp	Mon May 02 09:05:23 2016 +0000
@@ -0,0 +1,28 @@
+/*
+#include "mbed.h"
+InterruptIn bouton(p18); //définition de p18 comme entrée d’interruption
+DigitalOut sortie1(p5); 
+Timer antirebond; // définition du Timer antirebond
+void toggle(void); // prototype de toggle
+int main()
+{   
+    bouton.mode(PullUp);
+    antirebond.start();
+    bouton.rise(&toggle); //attache l’adresse de la fonction au front montant du bouton
+    
+    while(1) 
+    {
+        //Programme principal  
+    }
+}
+    void toggle()
+    {
+        
+        if (antirebond.read_ms()>200) //autorisation de l’inversion seulement
+        { 
+        sortie1.write(!sortie1.read()); //si le Timer a dépassé 200ms
+        antirebond.reset(); //Remise à zéro du Timer
+        }
+    }
+    
+    */
\ No newline at end of file
diff -r 000000000000 -r e54fcd358582 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 02 09:05:23 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3
\ No newline at end of file