import ch.aplu.nxt.*; public class exemple { public exemple() { NxtRobot monrobot = new NxtRobot(); LightSensor ls = new LightSensor(SensorPort.S3); monrobot.addPart(ls); ls.activate(true); Gear gear = new Gear(); gear.setSpeed(30); monrobot.addPart(gear); while (true) { int lum = ls.getValue(); if (lum < 500) { gear.backward(1000); } } } public static void main(String[] args) { new exemple(); } // ------------------ Environment -------------------------- static { NxtContext.setStartPosition(0, 0); NxtContext.setStartDirection(90); NxtContext.useBackground("http://www2.cstrois-lacs.qc.ca/chenebleu/informatique/ladifference/k2.gif"); } }