urgent help required immediately - midlet coding of rsmedia

3 posts / 0 new
Last post
soumyatilak
soumyatilak's picture
urgent help required immediately - midlet coding of rsmedia

hi

i need some help with a simple midlet program for rs media. i want to know if my coding is right.

i just need the rsmedia todo a few arm movements. thats all.

can someone please help me out immediately? i need to get it ready by tonight.

i had done it earlier, but the files had got deleted off my computer, and now the code i rewrote is not working.

:(

 thanks

RoboOtr
RoboOtr's picture

Could you post the code?

soumyatilak
soumyatilak's picture

import com.sun.robot.humanoid.Humanoid;

import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class Main extends MIDlet {
   
    private final Humanoid humanoid;
   
    public Main() {
        humanoid = Humanoid.getInstance();
    }
   
    protected void startApp() throws MIDletStateChangeException{
       
        // Begin by adjusting to a good default position.
        humanoid.restoreDefaultPosition();
       
        // Exercise Routine
        exercise();
       
    }
   
    protected void pauseApp() {
        //stop the Robot
        humanoid.stop();
    }
   
   protected void destroyApp(boolean b) throws MIDletStateChangeException {
        //shutdown the Robot
        humanoid.shutdown();
    }
   
    private void exercise(){
       
        humanoid.SHOULDER_LEFT_SERVO.moveToPosition(0, 8);
        humanoid.SHOULDER_RIGHT_SERVO.moveToPosition(0, 8);
        humanoid.waitUntilStop();
        humanoid.SHOULDER_LEFT_SERVO.moveToPosition(22, 8);
        humanoid.SHOULDER_RIGHT_SERVO.moveToPosition(22, 8);
        humanoid.waitUntilStop();
        humanoid.WAIST_UP_DN_SERVO.moveToPosition(14, 8);
        humanoid.waitUntilStop();
        humanoid.WAIST_UP_DN_SERVO.moveToPosition(28, 8);
        humanoid.waitUntilStop();
        humanoid.LEFT_ARM.wave();
        humanoid.RIGHT_ARM.wave();
    }

}