src/ultrasonic_poller.java
//  Need to convert US result to an integer [0,255]
Need to convert US result to an integer [0,255]
Need to convert US result to an integer [ 0 255 ]
public void run() {
		int distance;
		while (true) {
			us.fetchSample(usData,0);							
			distance=(int)(usData[0]*100.0);					
			cont.processUSData(distance);						
			try { Thread.sleep(50); } catch(Exception e){}		
		}
	}
public void run ( ) { int distance ; while ( true ) { us . fetchSample ( usData , 0 ) ; distance = ( int ) ( usData [ 0 ] * 100.0 ) ; cont . processUSData ( distance ) ; try { Thread . sleep ( 50 ) ; } catch ( Exception e ) { } } }
Need to convert US result to an integer [0,255]
Need to convert US result to an integer [ 0 255 ]
// acquire data // extract from buffer, cast to int // now take action depending on value // Poor man's timed sampling