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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:3bfd0ae5b584
- Child:
- 1:7f2e4c9c6a40
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri May 24 10:05:01 2019 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX,115200);
+
+DigitalIn depart(A1);
+DigitalIn interrupteur(D7);
+DigitalOut led(LED1);
+
+DigitalOut sens(D8);
+PwmOut moteur(D9);
+
+int cas=0;
+
+int main()
+{
+ DigitalOut myled(LED1);
+
+ while(1) {
+
+ switch (cas) {
+ case 0: {
+
+ pc.printf("case 0\n\r");
+ if (depart != 0) {
+ cas = 1;
+ }
+ break;
+
+ }
+
+ case 1: {
+ pc.printf("case 1\n\r");
+ led = 1;
+ sens = 1;
+ moteur.pulsewidth_ms(10);
+ if (interrupteur == 0) {
+ cas = 2;
+ }
+ break;
+
+ }
+ case 2: {
+ pc.printf("case 1\n\r");
+ led = 0;
+ moteur.pulsewidth_ms(0);
+ break;
+
+ }
+ }
+ }
+}