Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. import lejos.nxt.*;
  2.  
  3. public class Program {
  4.    
  5.    public static void main(String[] args) throws InterruptedException {
  6.      
  7.       SensorPort.S1.addSensorPortListener(new SensorPortListener(){
  8.          @Override
  9.          public void stateChanged(SensorPort source, int oldValue,   int newValue) {
  10.             if(newValue>1000)
  11.                LCD.drawString("Released", 0, 0);
  12.             else
  13.                LCD.drawString("Pressed ", 0, 0);
  14.          }
  15.       });
  16.      
  17.       Button.waitForAnyPress();
  18.    }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement