task main(){ nMotorEncoder[UP] = 0; nMotorEncoder[RND] = 0; AbsMove(230,100); for(int i=0; i <= 5; ++i){ AbsMove(500,180); AbsMove(230,180); } AbsMove(500,180); AbsMove(0,0); }
task main(){ // checkBTLinkConnected(); nMotorEncoder[UP] = 0; nMotorEncoder[RND] = 0; //StartTask(get); while(true){ nxtDisplayTextLine(3,"RUP = %d",500); nxtDisplayTextLine(4,"RRND = %d",500); nxtDisplayTextLine(5,"RRND = %d",500); AbsMove(2000, 2000, 500); AbsMove(0, 0, 0); // motor[UP] = 100; // motor{RND] = 100; } }
//--------------------------------------------------------------------------- bool PCIM114GL::IsLastPosDone(int nAxis) { double dPos=m_dLastTargetPos[nAxis]; double dP=GetFeedbackPos(nAxis); if(dP>dPos-0.1 && dP<dPos+0.1) return true; else if(GetAxisStatus(nAxis,Axis_Const::INP)) AbsMove(nAxis,dPos); else return false; return false; }
task main() { checkBTLinkConnected(); nMotorEncoder[UP] = 0; nMotorEncoder[RND] = 0; StartTask(get); while(true) { fRec[0] = (Rec[0]-8)*40; fRec[1] = (Rec[1]-8)*40; nxtDisplayTextLine(3,"RUP = %d",fRec[0]); nxtDisplayTextLine(4,"RRND = %d",fRec[1]); AbsMove(fRec[0], fRec[1]); } }
LRESULT KItemNull::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { float const fX = (float)(GET_X_LPARAM(lParam)); float const fY = (float)(GET_Y_LPARAM(lParam)); switch (uMsg) { case WM_LBUTTONDOWN: if (PtInItem(fX, fY)) { if (KDebugConfig::ms_aBoolFlag[KDebugConfig::BOOL_SELECT_WINDOW_IN_CLIENT]) g_pUI->m_EditorMgr.UIEditorOperation(PLUGIN_UI_EDITOR_SEL_WND, (WPARAM)m_szItemName, 0); if (KDebugConfig::ms_aBoolFlag[KDebugConfig::BOOL_RESIZE_WND_AND_ITEM_MODE] && (fX > m_fAbsX + m_fWidth - 2 * KDebugConfig::ms_nResizeWindowHandleNodeHalfSize) && (fY > m_fAbsY + m_fHeight - 2 * KDebugConfig::ms_nResizeWindowHandleNodeHalfSize)) { KItemEditModeMgr::GetSelf().SetEditMode(EDIT_RESIZE_MODE); } else { KItemEditModeMgr::GetSelf().SetEditMode(EDIT_DRAG_MODE); } KItemEditModeMgr::GetSelf().SetCurrentEditItem(this); KItemEditModeMgr::GetSelf().SetDragStartPos(fX, fY); return TRUE; } break; case WM_MOUSEMOVE: if (wParam & MK_LBUTTON) { float fLastX; float fLastY; KItemEditModeMgr::GetSelf().GetFragStartPos(fLastX, fLastY); if (KItemEditModeMgr::GetSelf().GetEditMode() == EDIT_DRAG_MODE) AbsMove(fX - fLastX, fY - fLastY); else if (KItemEditModeMgr::GetSelf().GetEditMode() == EDIT_RESIZE_MODE) { float fWidth = m_fWidth + (fX - fLastX); float fHeight = m_fHeight + (fY - fLastY); if (fWidth < 0.0f) fWidth = 0.0f; if (fHeight < 0.0f) fHeight = 0.0f; SetSize(fWidth, fHeight); } KItemEditModeMgr::GetSelf().SetDragStartPos(fX, fY); return TRUE; } else if (PtInItem(fX, fY)) { static char szInfo[MAX_PATH] = { 0 }; _snprintf(szInfo, _countof(szInfo), "名字: %s\n x=%d, y=%d, w=%d, h=%d\n", m_szItemName, (int)m_fRelX, (int)m_fRelY, (int)m_fWidth, (int)m_fHeight); g_pUI->m_EditorMgr.UIEditorOperation(PLUGIN_UI_EDITOR_SHOW_INFO, (WPARAM)szInfo, 0); return TRUE; } break; } return FALSE; }
task main() { // Setup string sFriendlyName; IAmNXT = 2; MaxNXT = 3; setupHighSpeedLink(); // eraseDisplay(); bNxtLCDStatusDisplay = true; // Enable top status line displayHSpeedRxData[1] int delta = 2; // Create int 'delta' to the be Servo Change Rate. servoChangeRate[servo1] = delta; // Slow the Servo Change Rate down to only 'delta' positions per update. servoChangeRate[servo2] = delta; // Slow the Servo Change Rate down to only 'delta' positions per update. servoChangeRate[servo3] = delta; // Slow the Servo Change Rate down to only 'delta' positions per update. servoChangeRate[servo4] = delta; // Slow the Servo Change Rate down to only 'delta' positions per update. servoChangeRate[servo5] = delta; // Slow the Servo Change Rate down to only 'delta' positions per update. while(true) { while( HSpeedRxDataLen == 0 ) wait1Msec(10); if(HSpeedRxData[0] == 1){ AbsMove(2000,2000, 360); if(ServoValue[servo1] >= 191) // If servo1 is closer to 255 (than 0): { while(ServoValue[servo1] > 125) // While the ServoValue of servo1 is greater than 0: { servo[servo1] = 125; // Move servo1 to position to 0. } } if(ServoValue[servo2] < 64) // If servo1 is closer to 0 (than 255): { while(ServoValue[servo2] < 110) // While the ServoValue of servo1 is less than 255: { servo[servo2] = 110; // Move servo1 to position to 255. } } if(ServoValue[servo3] < 64) // If servo1 is closer to 0 (than 255): { while(ServoValue[servo3] < 110) // While the ServoValue of servo1 is less than 255: { servo[servo3] = 110; // Move servo1 to position to 255. } } if(ServoValue[servo4] < 64) // If servo1 is closer to 0 (than 255): { while(ServoValue[servo4] < 110) // While the ServoValue of servo1 is less than 255: { servo[servo4] = 110; // Move servo1 to position to 255. } } if(ServoValue[servo5] < 64) // If servo1 is closer to 0 (than 255): { while(ServoValue[servo5] < 110) // While the ServoValue of servo1 is less than 255: { servo[servo5] = 110; // Move servo1 to position to 255. } } } if(HSpeedRxData[0] == 2){ if(ServoValue[servo1] < 191) // If servo1 is closer to 0 (than 255): { while(ServoValue[servo1] < 255) // While the ServoValue of servo1 is less than 255: { servo[servo1] = 255; // Move servo1 to position to 255. } } if(ServoValue[servo2] >= 64) // If servo1 is closer to 255 (than 0): { while(ServoValue[servo2] > 0) // While the ServoValue of servo1 is greater than 0: { servo[servo2] = 0; // Move servo1 to position to 0. } } if(ServoValue[servo3] >= 64) // If servo1 is closer to 255 (than 0): { while(ServoValue[servo3] > 0) // While the ServoValue of servo1 is greater than 0: { servo[servo3] = 0; // Move servo1 to position to 0. } } if(ServoValue[servo4] >= 64) // If servo1 is closer to 255 (than 0): { while(ServoValue[servo4] > 0) // While the ServoValue of servo1 is greater than 0: { servo[servo4] = 0; // Move servo1 to position to 0. } } if(ServoValue[servo5] >= 64) // If servo1 is closer to 255 (than 0): { while(ServoValue[servo5] > 0) // While the ServoValue of servo1 is greater than 0: { servo[servo5] = 0; // Move servo1 to position to 0. } } AbsMove(0,0, 0); } if(HSpeedRxData[0] == 3){ AbsMove(0,0, 0); } } }