
As this is all done now I’ll set up the first projects. Below you’ll find my first sample:
package tospinout;
import lejos.nxt.*;
/**
* 2008-12-26 author 2spinout
*/
public class Cat
{
public static void main (String[] aArg)
throws Exception
{
// PortA = Motor.A = ultrasonic movement motor
// PortB = Motor.B = left driving motor
// PortC = Motor.C = right driving motor
// Port1 = SoundSensor
// Port2 = LightSensor
// Port3 = TouchSensor
// Port4 = UltrasonicSensor
LCD.drawString("2spinout",3,4);
Thread.sleep(2000);
Motor.B.setSpeed(720);// 2 RPM
Motor.C.setSpeed(720);
Motor.B.forward();
Motor.C.forward();
Thread.sleep (5000);
Motor.B.stop();
Motor.C.stop();
}
}
No comments:
Post a Comment