Signa-bot code for project BioRobotics, at University of Twente.

Dependencies:   mbed QEI MODSERIAL FastPWM ttmath Math

Revision:
4:bd21569250c7
Child:
5:fea5544804c1
Child:
7:e119b12e5e7f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motor_tryout.cpp	Mon Sep 30 11:36:51 2019 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h" 
+#include "MODSERIAL.h"
+
+DigitalOut motor1_pwm(D3);
+MODSERIAL pc(USBTX, USBRX);
+int main(void)
+{   
+    int frequency_pwm = 10000; //10 kHz PWM
+    PwmOut motor1_pwm(D3);
+    motor1_pwm.period(1.0/frequency_pwm); // T=1/f
+    while(true)
+    {
+        for(int pct = 0 ; pct <= 100 ; pct = pct +10)
+        {
+            motor1_pwm.write(pct/100.0); // write Duty Cycle
+            wait(0.1);
+        }
+    }
+}
\ No newline at end of file