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: Stepper.cpp
- Revision:
- 2:4102dd9293a6
- Parent:
- 1:66e95666c3b5
- Child:
- 3:57d3774612fc
diff -r 66e95666c3b5 -r 4102dd9293a6 Stepper.cpp --- a/Stepper.cpp Mon Jul 29 09:15:11 2013 +0000 +++ b/Stepper.cpp Fri Aug 02 13:59:28 2013 +0000 @@ -38,8 +38,24 @@ { // bool read_1(); - if (Endstop_Left != NC) ESL = true; else ESL = false; - if (Endstop_Right != NC) ESR = true; else ESR = false; + if (Endstop_Left != NC) + { + ESL = true; + _Endstop_Left.mode (PullUp); + } + else + { + ESL = false; + } + if (Endstop_Right != NC) + { + ESR = true; + _Endstop_Right.mode (PullUp); + } + else + { + ESR = false; + } } } @@ -56,13 +72,13 @@ // else // Enable motor .. if not enabled .. short delay befor moveing .. - if (!_En) + if (_En) { - _En = 1; + _En = 0; wait (0.005); // 5 mSec. } - _En = 1; + _En = 0; { @@ -78,7 +94,7 @@ bool Stepper::Enable (bool OnOff) { - _En = OnOff; + _En = !OnOff; } // ------------------------------------------------------------------------------------