Utilisation des Leds

Dependencies:   IHM mbed

Files at this revision

API Documentation at this revision

Comitter:
Landry
Date:
Fri Apr 28 12:50:19 2017 +0000
Commit message:
projet client/serveur

Changed in this revision

IHM.lib Show annotated file Show diff for this revision Revisions of this file
main.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 fcdc465986b0 IHM.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IHM.lib	Fri Apr 28 12:50:19 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/slowness/code/IHM/#a9e51ac904e2
diff -r 000000000000 -r fcdc465986b0 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 28 12:50:19 2017 +0000
@@ -0,0 +1,67 @@
+#include "mbed.h"
+#include "IHM.h"
+*IHM ihm(PA_11, PA_12);
+Serial pc(USBTX, USBRX);
+
+DigitalOut led1(PB_3);
+DigitalOut led2(PB_7);
+DigitalOut led3(PB_6);
+DigitalOut led4(PB_5);
+DigitalOut led5(PB_3);
+DigitalOut led6(PB_1);
+DigitalOut led7(PB_0);
+DigitalOut led8(PB_2);
+
+
+int commandeLed = 0x00;
+char reception[512] = {0};
+char = mot;
+int i=0, j=0;
+int fin=0;
+
+
+int main() {
+    
+    pc.baud(9600);
+
+    while(1) {
+        
+        while(fin==0)
+        {
+            if(pc.readable())
+            {
+                mot=pc.getc();
+                reception[j]=mot;
+                
+                if(reception[j] == '$') {fin=1};
+                
+                j++;
+                
+            }
+        }
+        
+    ihm.LCD_clear();
+    ihm.LCD_gotoxy(0,0);
+    ihm.LCD_printf("%s", reception);
+    i=0;
+    
+    if(reception[i] == 'L')
+        {
+            led8=reception[i+1]-'0';
+            led7=reception[i+2]-'0';
+            led6=reception[i+3]-'0';
+            led5=reception[i+4]-'0';
+            led4=reception[i+5]-'0';
+            led3=reception[i+6]-'0';
+            led2=reception[i+7]-'0';
+            led1=reception[i+8]-'0';
+            
+            j=0; i=0;
+            fin=0;
+        }
+        
+}
+           
+ 
+    }
+}
diff -r 000000000000 -r fcdc465986b0 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Apr 28 12:50:19 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/093f2bd7b9eb
\ No newline at end of file