3
我要打的球向前移動幾釐米的給量,但到目前爲止,我還沒有能夠得到任何正常工作 這是代碼,我現在:SPHERO:如何讓它動給定長度
EditText distanceText = (EditText) findViewById(R.id.distanceText);
int inputMSec = Integer.parseInt(distanceText.getText().toString());
int time = (inputMSec - inputMSec/2);
// The ball is given the RollCommand at half speed.
RollCommand.sendCommand(mRobot, heading,0.5f);
// A handler is created to delay the Stop command.
final Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run() {
// Makes the ball stop
RollCommand.sendStop(mRobot);
}
// The variable 'time' defines how long the ball rolls until it is told to stop.
}, time);
是否有任何其他命令我可以發送到球而不是RollCommand? 或者任何人都可以找出如何處理來自EditText的輸入,以便距離正確嗎?