ding

Dependencies:   Encoder HIDScope mbed

Committer:
wiesdat
Date:
Mon Oct 27 11:18:50 2014 +0000
Revision:
1:1709bd849df0
Parent:
0:7e81becf02c6
Child:
2:ca2573919cb5
herman

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wiesdat 0:7e81becf02c6 1 #include "mbed.h"
wiesdat 0:7e81becf02c6 2 #include "encoder.h"
wiesdat 0:7e81becf02c6 3 #include "HIDScope.h"
wiesdat 1:1709bd849df0 4 #include <iostream>
wiesdat 0:7e81becf02c6 5
wiesdat 1:1709bd849df0 6 Encoder encoderA(PTD0,PTD2);
wiesdat 1:1709bd849df0 7
wiesdat 0:7e81becf02c6 8 PwmOut pwm(PTA5);
wiesdat 0:7e81becf02c6 9 DigitalOut dir(PTA4);
wiesdat 0:7e81becf02c6 10 HIDScope scope(5);
wiesdat 1:1709bd849df0 11
wiesdat 1:1709bd849df0 12 float enca = 0, encb =0;
wiesdat 1:1709bd849df0 13 float speed;
wiesdat 0:7e81becf02c6 14
wiesdat 0:7e81becf02c6 15 int main(){
wiesdat 1:1709bd849df0 16
wiesdat 0:7e81becf02c6 17 while(1){
wiesdat 1:1709bd849df0 18
wiesdat 1:1709bd849df0 19 cin>>speed;
wiesdat 1:1709bd849df0 20 pwm = 0.1;
wiesdat 1:1709bd849df0 21 enca = encoderA.getPosition();
wiesdat 0:7e81becf02c6 22 scope.set(0,pwm);
wiesdat 1:1709bd849df0 23 scope.set(1,enca);
wiesdat 0:7e81becf02c6 24 scope.send();
wiesdat 1:1709bd849df0 25
wiesdat 1:1709bd849df0 26 wait(0.2);
wiesdat 0:7e81becf02c6 27 }
wiesdat 0:7e81becf02c6 28 }
wiesdat 0:7e81becf02c6 29
wiesdat 0:7e81becf02c6 30
wiesdat 0:7e81becf02c6 31