// Move the motor... void myStepper::moveMotor (int dir, int steps ) { // Block until the motor stops... waitMotor(); #ifdef _DEBUGGING_ char outBuf[64]; sprintf(outBuf, "moveMotor(%s, %d)", dirNames[dir], steps); Serial.println(outBuf); #endif // Figure out the new target position... if ( dir == MC_DIR_FWD ) { m_tgtPos += steps; if ( m_tgtPos > m_maxPos) m_tgtPos = m_maxPos; } else { m_tgtPos -= steps; if ( m_tgtPos < m_minPos ) m_tgtPos = m_minPos; } // Start moving... moveNow(); #ifdef _DEBUGGING_ dumpDebug(); #endif }
void startDbot() { digitalDirection(RESETBTN, INPUT); clearScreen(); printString("robotReady"); buttonWait(); for (;;) { clearScreen(); printString("Normal Mode"); for (;;) { if (getButton1()) { for (;getButton1();) ; break; } if (!digitalInput(RESETBTN)) { normal(); } delayMs(50); } clearScreen(); printString("Not Normal"); for (;;) { if (getButton1()) { for (;getButton1();) ; break; } if (!digitalInput(RESETBTN)) { notNormal(); } delayMs(50); } clearScreen(); printString("No Expand"); for (;;) { if (getButton1()) { for (;getButton1();) ; break; } if (!digitalInput(RESETBTN)) { moveNow(); } delayMs(50); } } }