Hi Everyone,
I am pretty puzzled, I am trying to test the SRF02 ultrasonic sensor with the serial line, before writing the code to use it with i2c, but it is not working, I cant get a return value! The code is pretty short and tried various things, but I cant find the problem.
I also tried using the i2c library but I get no output either.
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print(0x00,BYTE);
Serial.print(0x51,BYTE);//start measurement
delay(1000);/wait
Serial.print(0x00,BYTE);
Serial.print(0x5E,BYTE);/read the two bytes value result of the measurement
delay(1000);
while(Serial.available()>0){
int foo = Serial.read();
Serial.println(foo,DEC);
}
}
I believe it is something really stupid I am getting wrong but I havent been able to see it.
Thanks.
-Claudio