B4R Question RX/TX use with Arduino UNO

kohle

Active Member
Licensed User
Longtime User
Hi,

why I cant use the Pin 0/1 for RX/TX on the Uno board with b4r ?
In the Adriano IDE it works fine to send data to a bluetooth shield.. See code/image

B4X:
#include "DHT.h"
#define dht_pin A5 //Pino DATA do Sensor ligado na porta Analogica A5
#define DHTTYPE DHT11
DHT dht(dht_pin, DHTTYPE);

void setup()
{
Serial.begin(9600);
delay(1000);
dht.begin();
}

void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();

// Mostra os valores lidos, na serial
Serial.print("Temp. = ");
Serial.print(t);
Serial.print(" C ");
Serial.print("Um. = ");
Serial.print(h);
Serial.println(" % ");
delay(2000);
}
 

Attachments

  • Circuito_BT_DHT11.png
    Circuito_BT_DHT11.png
    279.2 KB · Views: 1,988

Beja

Expert
Licensed User
Longtime User
The BT module HC-6 or HC-5 is fully assembled that can connect directly to the two pins of the Arduino (no need for 3.3v) or divide circuit.
If, when the program starts, is expected to immediately send data through the BT, then you should use HC-5 (the master) and not HC-6).
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
Hi,
here my pics of my HC-06. It says 3.3V level.
 

Attachments

  • IMG_20160603_090359-600x800.jpg
    IMG_20160603_090359-600x800.jpg
    102.1 KB · Views: 475
  • IMG_20160603_090723-600x800.jpg
    IMG_20160603_090723-600x800.jpg
    94.4 KB · Views: 477
Upvote 0

sanjog shakya

Member
Licensed User
Longtime User
You can use those pins from B4R. However as those pins are connected to the logger then any call to Log will interfere with your communication.
Can i directly connect HC-05 tx/rx pin to Arduino UNO rx/tx for using arduio uno rx/tx pin?
what will be the effect ?
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
Can i directly connect HC-05 tx/rx pin to Arduino UNO rx/tx for using arduio uno rx/tx pin?
what will be the effect ?

Hardware tx/rx is faster, up to 115200 Bauds, SoftwareSerial max. 9600 Bauds.
Depend what you are making. I use Wifi and Bluetooth with 9600 Bauds and its ok.

For RX you must have 3-3.3V, you can divide with resistors.
 
Upvote 0

sanjog shakya

Member
Licensed User
Longtime User
It is better to use SoftwareSerial with two other pins.

The effect will be that log messages will be sent to the Bluetooth module. It might also interfere with program uploads.
In some of the cases while using Arduino UNO pins may be insufficients where as Rx/Tx pin are left unused.

Is there no any idea to prevent the log message not to sent to Bluetooth Module?

now i am using 5,6 pin with software serial its working good.

** I have used 2 (220ohms) resistor from the RX/Tx pin to 5,6 pin.Is it Necessary?I m using Hc-05 BlueToothModule.


Thanks for reply.
Best Regards.
sanjog
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
In some of the cases while using Arduino UNO pins may be insufficients where as Rx/Tx pin are left unused.

Is there no any idea to prevent the log message not to sent to Bluetooth Module?

now i am using 5,6 pin with software serial its working good.

** I have used 2 (220ohms) resistor from the RX/Tx pin to 5,6 pin.Is it Necessary?I m using Hc-05 BlueToothModule.


Thanks for reply.
Best Regards.
sanjog



No way to prevent the output dont go to the bluetooth module if it is connected to Hardware RX/TX

RX on the bluetooth modul must be 3.3 V and TX is 5 Volt
You need 2 resistors.

The first post, show a foto : circuito... Here you see how divide the voltage.

Here you can calculate the voltage : Output should be 3.0 to 3.3 Volt

I use for R1 - 2K2 (2200 ohm ) and R2 - 4K (4000 ohm)

(http://www.arduinoecia.com.br/p/calculador-divisor-de-tensao-function.html)
 
Upvote 0

sanjog shakya

Member
Licensed User
Longtime User
No way to prevent the output dont go to the bluetooth module if it is connected to Hardware RX/TX

RX on the bluetooth modul must be 3.3 V and TX is 5 Volt
You need 2 resistors.

The first post, show a foto : circuito... Here you see how divide the voltage.

Here you can calculate the voltage : Output should be 3.0 to 3.3 Volt

I use for R1 - 2K2 (2200 ohm ) and R2 - 4K (4000 ohm)

(http://www.arduinoecia.com.br/p/calculador-divisor-de-tensao-function.html)
Thanks for the info Kohle.
 
Upvote 0

sanjog shakya

Member
Licensed User
Longtime User
Remove all the calls to the Log keyword.
Thank you Erel now i can you Rx/Tx pin ;) but stuck on one thing:(. As when using softwareSerial we have defined softwareserial and astreams like :
B4X:
SoftwareSerial1.Initialize(9600, 10, 11) 'software serial port on pins 10 and 11
astream.Initialize(SoftwareSerial1.Stream, "astream_NewData", Null)
Now when using Rx/Tx how can i initialize astream ?

Many Many thanks for the support.
Best Regards,
Sanjog
 
Upvote 0
Top