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.
Diff: main.cpp
- Revision:
- 7:37ea12f2b18f
- Parent:
- 6:a58f18b765cd
--- a/main.cpp Fri Oct 23 19:24:05 2020 +0000
+++ b/main.cpp Sun Oct 25 16:47:59 2020 +0000
@@ -1,25 +1,23 @@
#include "mbed.h"
//
-// test led et liaison serie
+// test led
// GR 2020
// Universite Paris-Saclay - IUT Cachan
//
//
-
+#define TEMPO 0.5
Serial pc(USBTX, USBRX);
-DigitalOut led(LED1);
+DigitalOut led(PA_5); //LED1
int main()
{
- pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\r\n");
+ pc.printf("LED clignotante\r\n");
led=1;
while(1) {
- char c = pc.getc(); // Read hyperterminal
- if (c == '0') {
- led = 0; // OFF
- }
- if (c == '1') {
- led = 1; // ON
- }
+ led = 0; // OFF
+ wait(TEMPO);
+ led = 1; // ON
+ wait(TEMPO);
}
}
+