Hi everyone,
I was able to send information over Bluetooth serial port from my PC (Linux Xubuntu) to Arduino Uno. However if I want to send something from Arduino to PC then it doesn't work.
Here is my very simple Arduino sketch that can receive commands "F" - switch off diode, "T" - switch on diode or "B" - blink diode. It also supposed to send "Hellow World!" text to other Bluetooth device (in this case my PC). Last part didn't work.
char val;
int ledpin = 13;
boolean blink = true;
void setup() {
pinMode(ledpin, OUTPUT);
Serial.begin(9600);
}
void loop() {
if(Serial.available())
{
val = Serial.read();
}
if( val == 'T' ) {
digitalWrite(ledpin, HIGH);
blink = false;
}
else if (val == 'F') {
digitalWrite(ledpin, LOW);
blink = false;
}
else if (val == 'B' || blink == true) {
blink = true;
digitalWrite(ledpin, !digitalRead(ledpin));
}
Serial.println("Hello world!");
delay(1000);
}
Then from Linux console I can establish connection:
user@user-laptop:~$ sudo rfcomm connect 0 00:0E:0E:00:7F:32
Connected /dev/rfcomm0 to 00:0E:0E:00:7F:32 on channel 1
Press CTRL-C for hangup
after that I use CuteCom to look what is going on, I can not see "Hello world!" beign received, however I can send commands to Arduino without problem:
Any idea?