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 1:d5e81fb97eca, committed 2015-10-21
- Comitter:
- arunr
- Date:
- Wed Oct 21 11:49:33 2015 +0000
- Parent:
- 0:239a6daf84e4
- Commit message:
- home position werkt nauwkeurig;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 20 11:46:31 2015 +0000
+++ b/main.cpp Wed Oct 21 11:49:33 2015 +0000
@@ -65,29 +65,31 @@
void move_motor1_ccw (){
motor1_direction = 0;
- motor1_speed = 0.1;
+ motor1_speed = 1;
}
void move_motor1_cw (){
motor1_direction = 1;
- motor1_speed = 0.1;
+ motor1_speed = 1;
}
void movetohome(){
P = motor1.getPosition();
- D = (P - H);
-
- if (D >= -48 && D <= 48){
+
+ if (P >= -28 && P <= 28){
motor1_speed = 0;
}
- else if (D > 60){
- move_motor1_cw();
+ else if (P > 24){
+ motor1_direction = 1;
+ motor1_speed = 0.1;
}
- else if (D < -60){
- move_motor1_ccw();
+ else if (P < -24){
+ motor1_direction = 0;
+ motor1_speed = 0.1;
}
}
+
void move_motor1(){
P = motor1.getPosition();
D = (P - H);