i created wp8 app. connects bluetooth , detected it.and bluetooth module connected well. data not coming arduino phone :(
error code
if(btserial.available()) { serial.println(distance); btserial.write(distance); } else { serial.println("error"); -> prints }
in code error part printing in serial monitor. have attached pins in bluetooth device below pins.
rxd - 11, txd - 10, gnd - gnd, vcc - 5v,
please me why btserial.available() not firing ?
you have logic backwards. available() tests whether arduino has data in receive buffer. not test if connection ready. overall pattern of serial program
if(someserial.available()) { someserial.read... loop input print stuff received }
to write, write.
//no if's go someserial.write("my output")
you not need wait. 2 wire serial connection, have no flow control. in other words, there no signalling between arduino , bluetooth transceiver ready or other status. because baud rate of bluetooth link exceeds baud rate of arduino serial link, can't overflow bluetooth transmit stream.
the bluetooth aspect of negotiating connection meant transparent arduino. in other words, program same if using hardware serial port. if reason, need details connection, there special byte sequences allow communication bluetooth hardware.
Comments
Post a Comment