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: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 20:184839c241a7
- Parent:
- 19:1a3b61bd88c0
--- a/main.cpp Fri Oct 04 08:08:55 2019 +0000
+++ b/main.cpp Fri Oct 04 08:23:39 2019 +0000
@@ -10,14 +10,14 @@
FastPWM motor(D5);
AnalogIn pot(PTB2);
+AnalogIn pot(PTB2);
InterruptIn button(PTB3);
// timer opzetten = ticker
Ticker ticker;
// opzetten van hoekbepaling
-int pulses = 4200;
-QEI encoder (D13,D12,NC,pulses);
+QEI encoder (D13,D12,NC,32,X4_ENCODING);
// aparte functies
// functie hoekbepaling
@@ -38,7 +38,12 @@
{
pc.printf("motor speed is (%f)\r\n",pot.read());
pc.printf("pulse is (%i)\r\n",encoder.getPulses());
-}
+}
+
+// functie change direction
+void change_direction()
+{
+
void main_loop()
{
@@ -53,6 +58,8 @@
enum (start_wait, move)
+// main functie !!
+
int main()
{
ticker.attach(&main_loop, 0.001f, &print_loop, 1f);