Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Commit [f79342] Maximize Restore History

Added publish option to remote sensor provider

Lawrie Griffiths Lawrie Griffiths 2014-05-16

changed EV3Menu/src/lejos/ev3/startup/GraphicStartup.java
changed ev3classes/src/lejos/remote/ev3/EV3Request.java
changed ev3classes/src/lejos/remote/ev3/RemoteRequestEV3.java
changed ev3classes/src/lejos/remote/ev3/RemoteRequestSampleProvider.java
copied EV3RemoteEV3/src/RemoteTest.java -> EV3RemoteEV3/src/RemoteRequest5.java
EV3Menu/src/lejos/ev3/startup/GraphicStartup.java Diff Switch to side-by-side view
Loading...
ev3classes/src/lejos/remote/ev3/EV3Request.java Diff Switch to side-by-side view
Loading...
ev3classes/src/lejos/remote/ev3/RemoteRequestEV3.java Diff Switch to side-by-side view
Loading...
ev3classes/src/lejos/remote/ev3/RemoteRequestSampleProvider.java Diff Switch to side-by-side view
Loading...
EV3RemoteEV3/src/RemoteTest.java to EV3RemoteEV3/src/RemoteRequest5.java
--- a/EV3RemoteEV3/src/RemoteTest.java
+++ b/EV3RemoteEV3/src/RemoteRequest5.java
@@ -1,33 +1,24 @@
 import java.io.IOException;
 
-import lejos.hardware.Audio;
 import lejos.remote.ev3.RemoteRequestEV3;
-import lejos.robotics.RegulatedMotor;
+import lejos.remote.ev3.RemoteRequestSampleProvider;
 
 
-public class RemoteTest {
+public class RemoteRequest5 {
 
-
-	public static void main(String[] args) {
-		try {
-			RemoteRequestEV3 ev3 = new RemoteRequestEV3("192.168.0.9");
-			Audio audio = ev3.getAudio();
-			audio.systemSound(2);
-			System.out.println("connected to ev3 " + ev3.getType());
-			System.out.println("connected to ev3 " + ev3.getName());
-			//ev3.setDefault();
-			RegulatedMotor motor = ev3.createRegulatedMotor("A", 'L');
-			System.out.println(motor.getMaxSpeed());
-			motor.setSpeed(Math.round(motor.getMaxSpeed()));
-			motor.rotate(1000);
-			//motor.waitComplete();
-			motor.close();
-			audio.systemSound(3);
-			ev3.disConnect();
-			System.out.println("ende");
-		} catch (IOException e) {
-			System.err.println("An exception occurred: " + e);
+	public static void main(String[] args) throws IOException {
+		RemoteRequestEV3 ev3 = new RemoteRequestEV3("192.168.0.9");
+		
+		System.out.println("Connected");
+		RemoteRequestSampleProvider sp = (RemoteRequestSampleProvider) ev3.createSampleProvider("S1", "lejos.hardware.sensor.EV3IRSensor", "Distance");
+		
+		float[] sample = new float[sp.sampleSize()];
+		
+		for(int i=0;i<30;i++) {
+			sp.fetchSample(sample, 0);
 		}
+		
+		sp.close();
 
 	}