Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,223 Views

After sending text from phone via BT its showing in terminal window but not in arduino serial monitor

OS: MAC

Board : Intel® Edison

Phone : Samsung Galaxy Note 3 & Sony Xperia P

there was "ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd" not "ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd -d"

anyway i changed that to "ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd -C"

 

After uploading serial monitor is showing

"read error Bad file descriptor"

"open error No such file or directory"

^ this problem remains ...

 

After followed this two 

https://software.intel.com/en-us/blogs/2015/05/19/communicate-to-arduino-code-with-your-android-phon... comment-1847213 IoT - Communicate to Arduino code with your Android* Phone by Bluetooth Serial Port Profile (SPP) on Intel® Edison | Int…

 

 

But now i can connect to phone successfully,

and after sending text from phone its showing in terminal window but not in arduino serial monitor  

7 Replies
Highlighted
Employee
5 Views

Hi,

Have you completed the "Setup for Edison Bluetooth service:" and "Setup for Edison Arduino sketch:" sections of https://software.intel.com/en-us/blogs/2015/05/19/communicate-to-arduino-code-with-your-android-phon... comment-1847213 IoT - Communicate to Arduino code with your Android* Phone by Bluetooth Serial Port Profile (SPP) on Intel® Edison | Int… without an errors? Did you download and install the library for Bluetooth SPP?

Are you using the Bluetooth App recommended in the document? What version of the Arduino IDE are you using? Are you selecting the correct board and COM port?

Sergio

0 Kudos
Highlighted
Novice
5 Views

Hello,

Yes i have completed the "Setup for Edison Bluetooth service:" and "Setup for Edison Arduino sketch:" section

but problem is

after uploading code successfully when opening serial monitor its showing rapidly

"read error Bad file descriptor"

"open error No such file or directory"

 

Yes i have download and install the library for Bluetooth SPP.

Yes i am using Bluetooth app pro App

My arduino IDE is 1.6.6

Yes i have selected correct COM port (Blink is working fine )

the issue is only happening on the Arduino IDE side.

"I am following all procedure, then opening Bluetooth app pro App from phone

then connecting to edison board in CMD line mode

then performing this command "cat /dev/rfcomm0" on terminal

then sending text and that text is showing in my pc's terminal but not in serial monitor of arduino1.6.6 IDE"

0 Kudos
Highlighted
Employee
5 Views

Hi,

What is the output of systemctl status bluetooth-spp-pin? Do you see the service as enabled? What image are you using, what is the output of configure_edison –version?

Can you post a picture of both the serial monitor window and the Linux terminal, after sending the command? What happens after you run cat /dev/rfcomm0?

Sergio

0 Kudos
Highlighted
Novice
5 Views

output of systemctl status bluetooth-spp-pin

 

 

after using cat /dev/rfcomm0 <- Showing text in terminal which is sends from phone</strong>

 

after using cat /dev/ttyGS0 <- Not showing text in terminal also not in serial monitor

Serial monitor is start showing this error after opening it

Thanks.

0 Kudos
Highlighted
Employee
5 Views

Hi,

I followed https://software.intel.com/en-us/blogs/2015/05/19/communicate-to-arduino-code-with-your-android-phon... comment-1847213 IoT - Communicate to Arduino code with your Android* Phone by Bluetooth Serial Port Profile (SPP) on Intel® Edison | Int… .

For the "Setup for Edison Bluetooth service:" I downloaded the file using wget . The rest of the steps are the same.

For the "Setup for Edison Arduino Sketch" I downloaded the library and copied its contents to Documents/Arduino/libraries/libraries.

In the Arduino IDE preferences set the sketchbook location to /Users/agent/Documents/Arduino and save. Restart the IDE. After restart, go to examples, make sure you have the "Intel Edison BT SPP Driver Library", open the bt_test file and compile/upload it to your board. Remember that for uploading Arduino sketches to the IDE you need to select the correct board and com port. My COM port is /dev/cu.usbmodem1473.

After this you shouldn't receive any errors after uploading. The "Setup for your phone" steps were made correctly. I looked at https://software.intel.com/en-us/articles/intel-edison-board-getting-started-with-bluetooth IoT - Intel® Edison Board Getting Started with Bluetooth* | Intel® Developer Zone for the steps on how to connect.

Let me know if this works for you.

Sergio

0 Kudos
Highlighted
Novice
5 Views

its working "cat /dev/rfcomm0 > /dev/ttyGS0" 

only this command is sending data to arduino IDE serial monitor.

This problem is Not solved though this is not problem

after uploading code successfully when opening serial monitor its showing rapidly

"read error Bad file descriptor"

"open error No such file or directory"

Here is my android code to control LEDPIN 13 on and off.

If i send text through serial monitor its working fine but if i send from phone then text is only showing in serial monitor not working. What is the difference here ?

int ledPin = 13;

int state = 0;

int flag = 0;

void setup() {

pinMode(ledPin, OUTPUT);

digitalWrite(ledPin, LOW);

Serial.begin(9600);

}

void loop() {

if(Serial.available() > 0){

state = Serial.read();

flag=0;

}

if (state == '0') {

digitalWrite(ledPin, LOW);

if(flag == 0){

Serial.println("LED: off");

flag = 1;

}

}

else if (state == '1') {

digitalWrite(ledPin, HIGH);

if(flag == 0){

Serial.println("LED: on");

flag = 1;

}

}

}

/servlet/JiveServlet/showImage/2-354534-248531/Screen Shot 2015-11-28 at 1.48.27 PM.png

When sending "1","0" form Serial Monitor its showing LED : on, LED : off

but when sending from phone its just showing 1 0 1 0

0 Kudos
Highlighted
Employee
5 Views

You can get the values printed in the serial monitor if you upload the sketch and you can send data from your phone to the serial monitor from linux using cat /dev/rfcomm0 > /dev/ttyGS0, but not at the same time. This is because you are sending data to a single serial port from two different sources. If you are sending data from the phone the serial monitor receives this data correctly but not the data from the Arduino. If you upload the sketch you can start sending 0s and 1s and it will show LED: on/off but the connection from your phone will not work. An alternative for this is to follow the suggestion from and synchronize the data you are sending so you can do it at the same time.

Sergio

0 Kudos