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 MODSERIAL mbed QEI biquadFilter
Revision 5:d60a42727a3e, committed 2015-09-30
- Comitter:
- bscheltinga
- Date:
- Wed Sep 30 15:31:10 2015 +0000
- Parent:
- 4:96e47998d495
- Child:
- 6:ca89d5e17328
- Child:
- 9:832b48f48a10
- Commit message:
- Attempt to get the motorspeed variable to the potmeter
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Sep 30 15:19:10 2015 +0000
+++ b/main.cpp Wed Sep 30 15:31:10 2015 +0000
@@ -9,29 +9,14 @@
DigitalIn buttonL2(PTA4);
DigitalIn buttonH1(D2);
DigitalIn buttonH2(D6);
+AnalogIn potmeter(A1);
-//dit kan worden gebruikt om de verschillende slagnelheden toe te passen door de buttons te veranderen in thresholds
int main()
{
+ double n = (potmeter.read()/1000);
while(true) {
- if (buttonL1.read() <0.5) {
- motor2speed = 0.1;
- motor2direction = 0;
- }
- if (buttonL2.read() <0.5) {
- motor2speed = 0.4;
- motor2direction = 0;
- }
- if (buttonH1.read() <0.5) {
- motor2speed = 0.7;
- motor2direction = 0;
- }
- if (buttonH2.read() <0.5) {
- motor2speed = 0.99999;
- motor2direction = 0;
- } else {
- motor2speed =0;
- }
+ motor2direction = 1;
+ motor2speed = n;
}
}
