Bouke Scheltinga / Mbed 2 deprecated Werk_college_23sept

Dependencies:   Encoder HIDScope MODSERIAL mbed QEI biquadFilter

Files at this revision

API Documentation at this revision

Comitter:
bscheltinga
Date:
Wed Sep 30 15:50:11 2015 +0000
Parent:
5:d60a42727a3e
Child:
8:be449365de62
Commit message:
Control motor with potmeter and print PmwOut on Putty

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 30 15:31:10 2015 +0000
+++ b/main.cpp	Wed Sep 30 15:50:11 2015 +0000
@@ -2,7 +2,6 @@
 #include "encoder.h"
 #include "MODSERIAL.h"
 
-//Motor 2
 DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
 PwmOut motor2speed(D5);
 DigitalIn buttonL1(PTC6);
@@ -11,12 +10,16 @@
 DigitalIn buttonH2(D6);
 AnalogIn potmeter(A1);
 
+MODSERIAL.pc (USBTX,USBRX);
+
 
 int main()
 {
-   double n = (potmeter.read()/1000);
+pc.baud (9600);
     while(true) {
+        double n = (potmeter.read()/300);
         motor2direction = 1;
         motor2speed = n;
+        pc.printf("motor2speed = %d", n);
     }
 }