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 MODSERIAL HIDScope mbed
Revision 4:a92d354265b2, committed 2015-09-21
- Comitter:
- ThomasBNL
- Date:
- Mon Sep 21 11:14:11 2015 +0000
- Parent:
- 3:61c024f896ad
- Child:
- 5:14f6189d86a2
- Commit message:
- print position toegevoegd motor werkt niet
Changed in this revision
| HIDScope.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Mon Sep 21 11:14:11 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/bscheltinga/code/HIDScope/#6ad05ef9a696
--- a/main.cpp Mon Sep 21 10:43:37 2015 +0000
+++ b/main.cpp Mon Sep 21 11:14:11 2015 +0000
@@ -7,21 +7,23 @@
DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
PwmOut motor2speed(D5);
DigitalIn button(PTA4);
+Encoder motor2(D13,D12,true);
+MODSERIAL pc(USBTX,USBRX);
+
int main()
{
+ pc.baud(9600);
while(true) {
- if (button.read() == 0) { //if button pressed
+ if (button.read() < 0.5) { //if button pressed
motor2direction = 1;
motor2speed = 0.3f;
+ //pc.printf("positie = %d \n", motor2.getPosition());
} else { // If button is not pressed
motor2direction = 0;
- motor2speed = 0.3f;
+ motor2speed = 0;
+ //pc.printf("positie = %d \n", motor2.getPosition());
}
- double position = getPosition();
- printf("positie = %d", position);
+ //pc.printf("positie = %d \n", motor2.getPosition());
}
}
-
-// Geen functie hieronder nog
-// Encoder encoder1(D13,D12);
\ No newline at end of file
