Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
452 views
in Technique[技术] by (71.8m points)

Arduino DMX + Bluetooth Serial read problem

Hi im using the Conceptinetics DMX Libary. Together with a CTC-DRA-10-R2 shield.

I got 2 Arduinos with a HC-05 Bluetooth module. So far its running fine. I can send a String from one device to the Arduino with a DMX-Shield. All good so far.

First i send a String on Arduino A:

if (ble.available()) {
    delay(4);
    ble.println("1");
  }

And read on arduino B the incoming string. cast it to int and add it to a variable:

 if (ble.available()) {
    delay(5);
    String receiveMsg = ble.readStringUntil('
');
    int val = receiveMsg .toInt();
    dmx_master.setChannelValue ( 1, val );

Works. So i can send a value from on arduino to a DMX channel.

Now i want to send that value back to arduino A. So i put the value into a String and send it. But in that case. the arduino A only got once in the

if (ble.available())

to read the incoming String.

It seems that the arduino get stucked trying to reading a incoming String. If i disconnect the arduino B from power. I can see some incoming Strings on arduino A. and than it gos back into the main loop.

I tried to send and read at the same time with other programms and it worked well. It seem that the serial Bluetooth output and the DMX output have a problem. DMX is on 25000 Baud and blueooth on 38400


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...