Dependencies:   HIDScope MODSERIAL mbed

Fork of Milestone_1 by Casper Kroon

Revision:
1:aa505856416d
Parent:
0:9922b502cbc3
Child:
2:735ca8577f31
diff -r 9922b502cbc3 -r aa505856416d main.cpp
--- a/main.cpp	Tue Sep 25 12:31:41 2018 +0000
+++ b/main.cpp	Tue Sep 25 14:50:26 2018 +0000
@@ -13,22 +13,21 @@
 
 volatile float x;
 volatile float y;
-volatile float x_prev;
 
 void sendData() {
     scope.set(0,potmeter); //set the potmeter data to the first scope
-//    scope.set(1,x);
-    scope.send();
+    scope.set(1,x);
+    scope.send(); //send the datapoints of the 2 motors
 }
 
 int main() {  
     float u = -0.3f; //determineusefulvalue, -0.3f is justanexample
-//    x = 1;
+    directionpin = u > 0.0f; //if bigger than 0, gives true, otherwise gives false   
+    x = 1; //placeholder value for potmeter of second motor
     
-    pwmpin.period_us(60); //60 microsecondsPWM period, 16.7 kHz
-    led.period(0.00001); //10kHz
-    ticker.attach(&sendData, 0.001f); //send data to hidscope at 1kHz
-    directionpin= u > 0.0f; //eithertrueor false   
+    pwmpin.period_us(60); //60 microseconds PWM period, 16.7 kHz
+    led.period_us(60); //60 microseconds
+    ticker.attach(&sendData, 0.005f); //send data to hidscope at 200Hz
 
     while (true) {
         pwmpin.write(potmeter); //pwm of motor is potmeter value