Huh? There is nothing on that device to be programmed.
and yet a get an error when y run it.
Error is "avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x00
avrdude: stk500_cmd(): programmer is out of sync"
This is not a run-time error. This is an upload error. If you are trying to upload code to the sensor, it's no wonder you have a problem.
If you are trying to upload code to the Arduino board, and you get this error with the sensor attached, but not without the sensor attached, it should be obvious what you need to do.
Ok thank you Paul i solved the error, i wasnt trying to program the SRF02 though, but since it was connected during upload i guess some program package was mistaken for a comand and the sensor responded so it caused a failed upload. thank you for your sugestion.
Yet i havnt been able to get it to work yet, what i meant woth connecting was:
5v from arduino to 5v in SRF02
Tx in arduino to RX in SRF
RX in arduino to Tx in SRF
GNd in arduino to GND and MODE in SRF
What i meant with program was this:
int incomingByte = 0; // for incoming serial data
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
}
void loop() // run over and over again
{
Serial.println(00); // srf02 direction
Serial.println(83); //srf02 starte rangeing command
delay(100);
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
int incomingByte = Serial.read();
// say what i received:
Serial.print("I received: ");
Serial.println(incomingByte, HEX);
}
}
im using serial monitor yet i can only see what i send, i dont get any answer from srf02..
According to this site, SRF02 Ultra sonic range finder, you should send the sensor 2 bytes to start it working. The first byte is the address of the device (0 by default). The second byte is the command - what the sensor should do.
You, instead, are sending it 6 bytes - 0, , , 83, , .
Not really surprising then that the sensor doesn't respond. It doesn't know how to . So, stop sending the . Use Serial.print, not Serial.println.