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 6:ca89d5e17328, committed 2015-09-30
- Comitter:
- bscheltinga
- Date:
- Wed Sep 30 15:50:11 2015 +0000
- Parent:
- 5:d60a42727a3e
- Child:
- 8:be449365de62
- Commit message:
- Control motor with potmeter and print PmwOut on Putty
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:31:10 2015 +0000
+++ b/main.cpp Wed Sep 30 15:50:11 2015 +0000
@@ -2,7 +2,6 @@
#include "encoder.h"
#include "MODSERIAL.h"
-//Motor 2
DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
PwmOut motor2speed(D5);
DigitalIn buttonL1(PTC6);
@@ -11,12 +10,16 @@
DigitalIn buttonH2(D6);
AnalogIn potmeter(A1);
+MODSERIAL.pc (USBTX,USBRX);
+
int main()
{
- double n = (potmeter.read()/1000);
+pc.baud (9600);
while(true) {
+ double n = (potmeter.read()/300);
motor2direction = 1;
motor2speed = n;
+ pc.printf("motor2speed = %d", n);
}
}
