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.
Diff: main.cpp
- Revision:
- 2:5ec7af981b32
- Parent:
- 1:63edfaecc73e
- Child:
- 3:b9e2c7d52953
--- a/main.cpp Wed Oct 14 10:33:11 2015 +0000
+++ b/main.cpp Wed Oct 14 12:34:25 2015 +0000
@@ -21,8 +21,8 @@
// calculating pulses to rotations in degree.
-const double Offset = 3450 ;//8400 counts is aangegeven op de motor. 3500 is almost 1 cirkel with a bit of overshoot 3450 looks good. about 10 - 20 counts oveshoot. for moter 1(tape)! Motor 2 almost the same(nice)
-const double resolution = Offset / 360;
+const double pulses_per_revolution = 4200 ;//8400 counts is aangegeven op de motor for x4. 10 - 30 counts oveshoot. for moter 1(tape)! Motor 2 almost the same(nice)
+const double resolution = pulses_per_revolution / 360;
double Rotation = 2; // rotation in degree
double movement = Rotation * 360 * resolution; // times 360 to make Rotations degree.
@@ -30,7 +30,7 @@
volatile bool flag_motor = false;
volatile bool flag_pcprint = false;
-// making flags.
+// making function flags.
void Go_flag_motor()
{
flag_motor = true;
@@ -88,7 +88,7 @@
int main()
{
- aansturen.attach( &Go_flag_motor, 0.001f ); // 100 Hz // timer 0.00001f motor keeps spinning
+ aansturen.attach( &Go_flag_motor, 0.01f ); // 100 Hz // timer 0.00001f motor keeps spinning
Printen.attach(&Go_flag_pcprint,0.1f); // 10 Hz // printstatement here because printing cost to much time. the motor void wouldn't be completed
while( 1 ) {