2
I am using the atmega328 serial to control a bluetooth module, but I would like to use the same serial output to communicate with another atmega328, as I can do ?
2
I am using the atmega328 serial to control a bluetooth module, but I would like to use the same serial output to communicate with another atmega328, as I can do ?
0
The Atmega328 has only 2 pins for serial communication, they are: 2.3. On an Arduino board (such as Uno and Duemilinove), these pins are mapped to the 0.1 pins.
Serial communication via USB cable on an Arduino board also uses these pins. This means that you cannot make a program that communicates via Serial with a computer and at the same time with any other device.
The same is true for a Bluetooth device that communicates via serial. Since you are using Arduino pin 0.1 to connect the bluetooth device, then you cannot connect any other device with Atmega328 via serial.
Your alternatives are:
Use an Atmega1280 (micro-controller of the Arduino Mega board). This chip has 4 serial outputs. So you can connect bluetooth to one of these outputs and the rest you can use to connect other serial devices;
Use bluetooth device via serial and communicate an Arduino with another via Ethernet;
Find a bluetooth device that communicates via I2C protocol. I can’t say it exists.
Make an Arduino to communicate with another via I2C protocol. This one looks very interesting and even has a documentation: https://www.arduino.cc/en/Tutorial/MasterWriter
I understand, but if Arduino uno can receive data from a USB and have a bluetooth module stuck in Arduino uno, then atmega328 can manage the serial for double use. Right ? I want to record the Atmega in the Arduino Uno, then take it and stick in a Otoboard, so I would not have the USB of the oiginal board and so I could do what I wish. You understand my déuvida ?
Yes I understand. See that although you connect a USB cable, communication is serial. In Arudino there is a chip that converts USB-Serial. The USB serial is connected in parallel with the 0.1 pin of an Arduino card. So it’s the same serial and you can’t use it for two different purposes.
I understood, But pretend that there is no USB on the board Andy, then I could turn on something else in parallel, agree ?
Yes. But you want to call in parallel and be able to control two different things differently? If the data that goes via bluetooth also goes to the other Arduindo, then okay, it might work. But if you want different behaviors, then with a serial there’s just no way.
I’ll have to give an example: I made a device that connects with an analytical balance. The Arduino is connected only on this balance. If I want to connect a computer at the same time, sending other information, then I need a micro-controller that gives me more serial outputs. The same goes for when you use Atmega328 without being on an Arduino board.
Browser other questions tagged arduino
You are not signed in. Login or sign up in order to post.
Can you do some serial communication?
– cantoni
There are two alternatives: to use a switch with transistors or with logic ports. This would be a "gambiarra", but it is possible to do it. You would need to spend one more digital port to "activate" and "disable" this key. You can also use the Softwareserial library and use some Arduino digital ports, as if they were serial ports (this is emulated via software, as the library name already says). Unfortunately this question is closed and I can not put more details about these things in a comment field.
– Avelino