Programming Milestone Group 7 BMT M9

Dependencies:   FastPWM MODSERIAL mbed

Revision:
0:1e216b50d323
Child:
1:67b19c59b8c9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Sep 25 10:36:50 2018 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+PwmOut pwmpin();
+DigitalOut directionpin();
+pwmpin.period_us(60); //60 microseconds PWM period, 16.7 kHz
+AnalogIn potmeter();  // Analoge input van potmeter
+
+int main()
+{
+    while (true) {
+        float u = -0.3f; //determine useful value, -0.3f is just an example
+        directionpin = u > 0.0f; //either true or false
+        pwmpin = fabs(u); //pwm duty cycle can only be positive, floating point absolute value
+        float pot = potmeter.read();
+    }
+}
\ No newline at end of file