sorry for this "necro post", but I'm running out of ideas.
I'm trying to interface an arduino with a bluetooth chip, enabling the arduino to talk to my computer (over bluetooth).
I'd like to describe the situation / problem first, I'll give a short list of technical data at the bottom. All help is appreciated.
I have an arduino that I have hooked up to a bluetooth device, I'm trying to make the arduino talk to my computer (which also has a bluetooth device, obviously). I have tried the SoftwareSerial library, which doesn't appear to ever see anything it can read, a custom method that is based on a interrupt on the rx pin, trying to read the bits as the fly past (to my understanding this is also how NewSoftSerial reads data), aswell as the SoftwareSerial library.
I can send data to my laptop without problems, it arrives just as I send it (with a quirk of inverted linebreak/newline characters, but thats a quirk of the bluetooth chip I reckon), the receiving data on the arduino side is the problem.
SoftwareSerial denies the existance of ever seeing anything arrive.
The NewSoftSerial however, shows promise.
While calls to the available() method say that it has nothing to read, pure calls to the read() method give back invalid values (-1, no byte found). But this is the part where I see promise, because it will print a number of error bytes based on the number of characters I sent to the arduino (bluetooth device).
ie: I send a message "hello" to the arduino, the arduino would print 5 times a -1 value to the computer through its hardware serial.
This tells me that it is receiving something
, but I have the feeling it doesn't know what it is it is trying to read..
Any insights and help regarding the matter would be most appreciated!
The sketch(es), in case it yields any information regarding the issue:
NewSoftSerial mySerial = NewSoftSerial(2, 3, false);
pinMode(2, INPUT); //softserial rx
pinMode(3, OUTPUT); //softserial tx
pinMode(4, OUTPUT); //reset pin of the bluetooth module
pinMode(5, INPUT); //"has a connection" pin of the bluetooth module
pinMode(8, OUTPUT); //led
delay(1800); //reset the bluetooth module for at least 1500ms
//most basic attempt, which prints a number of -1's equal to the number of characters sent to the arduino
//basic test attempt, doesn't print anything on Serial
if(!digitalRead(5)) //this pin goes HIGH if the bluetooth device has a connection
digitalWrite(8, HIGH); //light up a LED
digitalWrite(8, LOW); //no connection, turn off the LED
- OS of computer: ubuntu 9.10
- class2 transmitter
- Arduino IDE version 16
- NewSoftSerial version 10
- DFRduino duemilanove with atmega328 chip
- promi-ESD bluetooth chip
- 9600bps baud (baud rate of 9600, I assume?)
- 8 data bit, no parity, stop bit 1
- H/W flow control
- 3.3v input voltage (a custom chip drops the arduino voltages for safe interfacing)
- pulls 73mA in its most power hungry state
- class1 transmitter