import lejos.nxt.Sound; public class PlaySounds implements MotivationBehavior { private final static int DELAY = 10000; private int nextSound; private int motivation; public PlaySounds(int motivation) { this.motivation = motivation; nextSound = (int) System.currentTimeMillis() + DELAY; } public int motivation() { if ((int) System.currentTimeMillis() >= nextSound) return motivation; return 0; } public void action() { Sound.beepSequence(); try { Thread.sleep(200); } catch (InterruptedException e) { } Sound.beepSequenceUp(); nextSound += DELAY; } }