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.
Fork of RoboBirdV1 by
Diff: main.cpp
- Revision:
- 6:cf20f04dbab4
- Parent:
- 5:d47e6a96256b
- Child:
- 7:2042e359bfc3
--- a/main.cpp Mon Sep 28 18:39:43 2015 +0000 +++ b/main.cpp Mon Sep 28 18:47:56 2015 +0000 @@ -10,7 +10,7 @@ Ticker Pot; Ticker PC; -double z; +double z=0; const double twopi = 6.2831853071795; const double pi = pi/2; int Pulses; @@ -19,26 +19,26 @@ void readpot() { - z = PotMeter.read()/10; + z = PotMeter.read(); } void print() { - pc.printf ("Potmeter = %f\n", z); // het weergeven van de waarde waar z (PotMeter) op dat moment is - pc.printf ("Rotatie = %f [pi radialen] \n", Rotatietwopi); + //pc.printf ("Potmeter = %f\n", z); // het weergeven van de waarde waar z (PotMeter) op dat moment is + //pc.printf ("Rotatie = %f [pi radialen] \n", Rotatietwopi); } int main() { pc.baud(115200); PowerMotor.write(0); - Pot.attach(readpot,0.001); // Deze ticker moet de waarde uitlezen van de PotMeter 10 keer per seconde - PC.attach(print,0.5); + Pot.attach(readpot,0.1); // Deze ticker moet de waarde uitlezen van de PotMeter 10 keer per seconde + //PC.attach(print,0.5); while (true) { PowerMotor.write(z); - Pulses = Encoder.getPulses(); - Rotatie = (Pulses*twopi)/4192; - Rotatietwopi = fmod(Rotatie,twopi); + // Pulses = Encoder.getPulses(); +// Rotatie = (Pulses*twopi)/4192; +// Rotatietwopi = fmod(Rotatie,twopi); } }