-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSensorTest.java
More file actions
42 lines (33 loc) · 865 Bytes
/
SensorTest.java
File metadata and controls
42 lines (33 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package localisation;
import lejos.nxt.LCD;
import lejos.nxt.LightSensor;
import lejos.nxt.SensorPort;
import lejos.util.Delay;
/**
* Class for testing the light values
* nothing interesting here
*/
public class SensorTest {
private static float leftValue;
private static float rightValue;
private static LightSensor left = new LightSensor(SensorPort.S1);
private static LightSensor right = new LightSensor(SensorPort.S3);
private static boolean running=true;
public static void main(String[] args){
run();
}
public static void run(){
while(running){
generateLightValues();
LCD.drawString(leftValue+" "+rightValue+" ", 0, 0);
Delay.msDelay(50);
}
}
public void stop(){
running=false;
}
private static void generateLightValues(){
leftValue = left.getLightValue();
rightValue = right.getLightValue();
}
}