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: FastPWM HIDScope MODSERIAL QEI mbed
Diff: main.cpp
- Revision:
- 2:840f7aa50e55
- Parent:
- 1:d6acc3c6261a
- Child:
- 3:7421e53bf9bd
--- a/main.cpp Tue Sep 25 12:09:35 2018 +0000 +++ b/main.cpp Tue Sep 25 12:22:57 2018 +0000 @@ -18,12 +18,27 @@ FastPWM motor1_pwm(D5); FastPWM motor2_pwm(D6); +// Voor het laten zien van de data op de pc. +HIDScope scope(2); // Aantal kanalen wat doorgegeven wordt aan de hidscope +Ticker AInTicker; +float potwaarde1; +float potwaarde2; + +void ReadAnalogIn() +{ + scope.set(0,potwaarde1); // Zet de potwaarde in de eerste plot bij de HID scope. Deze wordt automatisch tegen de tijd geplot + scope.set(1,potwaarde2); + scope.send(); // Zendt de waardes naar de pc + } + int main(void) { motor1_pwm.period_ms(60); // period is 60 ms - - + AInTicker.attach(&ReadAnalogIn,0.01f); //Elke 0.01 sec. Lees de analoge waarde + while(true){ + potwaarde1 = potmeter1.read(); // Lees de potwaardes uit + potwaarde2 = potmeter2.read(); }