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:cc4683d537a7
diff -r 000000000000 -r cc4683d537a7 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jun 09 14:47:14 2022 +0000
@@ -0,0 +1,45 @@
+#include <mbed.h>
+
+//Jumper
+DigitalIn jumper(PA_2, PullDown);
+
+//Moteur balle
+DigitalOut INAB(PC_3);
+DigitalOut INBB(PH_1);
+PwmOut PWMB(PB_0);
+
+bool start = false;
+
+void init_moteur_balle(void);
+
+int main()
+{
+ init_moteur_balle();
+
+ while(1)
+ {
+ if(jumper==1)
+ {
+ INAB = 0;
+ INBB = 1;
+ PWMB.write(0.2);
+ }
+ else
+ {
+ INAB = 0;
+ INBB = 1;
+ PWMB.write(0);
+ }
+ }
+
+}
+
+
+void init_moteur_balle(void)
+{
+ INAB = 0;
+ INBB = 0;
+ PWMB.period(0.00005); // 20 kHz (valid 0 - 20 kHz)
+ PWMB.write(0);
+}
+