Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Encoder HIDScope mbed
Revision 2:ca2573919cb5, committed 2014-10-27
- Comitter:
- wiesdat
- Date:
- Mon Oct 27 13:38:30 2014 +0000
- Parent:
- 1:1709bd849df0
- Child:
- 3:8a8dc30fb08e
- Commit message:
- Krijg het heen en weer
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 27 11:18:50 2014 +0000
+++ b/main.cpp Mon Oct 27 13:38:30 2014 +0000
@@ -1,31 +1,41 @@
#include "mbed.h"
#include "encoder.h"
-#include "HIDScope.h"
+
#include <iostream>
Encoder encoderA(PTD0,PTD2);
PwmOut pwm(PTA5);
DigitalOut dir(PTA4);
-HIDScope scope(5);
+
+
+int32_t enca = 0, encb =0;
+float speed = 0.1;
+int n=0,a =1 ,b =0;
-float enca = 0, encb =0;
-float speed;
+int main()
+{
+
+ while(1) {
+
+
-int main(){
-
- while(1){
-
- cin>>speed;
- pwm = 0.1;
- enca = encoderA.getPosition();
- scope.set(0,pwm);
- scope.set(1,enca);
- scope.send();
-
- wait(0.2);
+ enca = encoderA.getPosition();
+
+
+ if(enca < -900) {
+ dir = 1;
+ }
+ if(enca > 0) {
+ dir = 0;
+ }
+
+ pwm = 1;
+ cout<<"enca"<<enca<<endl;
+
+ wait(0.1);
}
}
-
+