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 mbed
Fork of P_controller_motor_Bouke by
Revision 12:27abe8ee588c, committed 2015-09-21
- Comitter:
- ThomasBNL
- Date:
- Mon Sep 21 09:31:05 2015 +0000
- Parent:
- 11:c5befe79aa53
- Child:
- 13:e9ed79fc60f3
- Commit message:
- Werkende motor: motor draait beide richtingen op commando van knopje
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Sep 21 09:04:28 2015 +0000
+++ b/main.cpp Mon Sep 21 09:31:05 2015 +0000
@@ -3,12 +3,23 @@
#include "encoder.h"
#include "MODSERIAL.h"
-Encoder encoder1(D13,D12);
+//Motor 2
DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
PwmOut motor2speed(D5);
+DigitalIn button(PTA4);
int main()
{
- motor2direction = 1;
- motor2speed = 0.2f;
+ while(true) {
+ if (button.read() < 0.5) {
+ motor2direction = 1;
+ motor2speed = 0.2f;
+ } else {
+ motor2direction = 0;
+ motor2speed = 0.2f;
+ }
+ }
}
+
+// Geen functie hieronder nog
+Encoder encoder1(D13,D12);
\ No newline at end of file
