Hot answers tagged

20 votes
Accepted

What's the difference between all the Software Serial Libraries? Which one is Arduino Nano compatible?

This answer lists the 4 basic choices: HardwareSerial, always the best. Simply use the pre-defined Serial variable. On some Arduinos, there are extra HardwareSerial ports, called Serial1, Serial2, ...
slash-dev's user avatar
  • 2,029
13 votes
Accepted

How to work with non-traditional UART baud rates

The Arduino Nano cannot do 800 kb/s. As you can see in the source code, the bit duration is rounded to the nearest multiple of 8 CPU cycles. In your case, it is rounded to 3 × 8&...
Edgar Bonet's user avatar
  • 42.7k
6 votes

How to define a SoftwareSerial object inside a class?

Personally I wouldn't go down this route. Instead I would pass a Stream object (as a pointer or a reference) to the constructor and use that. Then it is up to your sketch to define what that Stream ...
Majenko's user avatar
  • 105k
6 votes

How to upload code without closing puTTY

There is an open source project that will do what you want. http://com0com.sourceforge.net/ The com0com will create virtual com ports for the programs to connect to. The hub4com will allow you to ...
jsotola's user avatar
  • 1,444
6 votes
Accepted

Bi-directional UART communication on single data wire, possible?

You can have bidirectional communication over a single wire by using open-collector outputs. For this, you could add a circuit like this on each side of the link: simulate this circuit – ...
Edgar Bonet's user avatar
  • 42.7k
5 votes
Accepted

Is it possible to receive a 9 bit protocol on the Arduino Uno with Arduino?

If you want to set the UART to 9-bit mode, you will have to set the UCSZ02 bit of the _ucsrb register to 1 in HardwareSerial::begin(). For example: void HardwareSerial::begin(unsigned long baud, byte ...
Edgar Bonet's user avatar
  • 42.7k
5 votes
Accepted

Is it possible to extract a hex file via UART from an Arduino?

AVRDUDE which is used by the IDE to send the content of HEX file from your computer, as a feature letting it to get back the data of the flash, in order to compare and see if data are correct. For a ...
Peter's user avatar
  • 355
5 votes

How to chose softserial library use on Arduino project?

I think your problem is that you need 4 serial ports. With software serial that's just not going to happen: SoftwareSerial can only receive on one serial port at any given time. AltSoftSerial is ...
Majenko's user avatar
  • 105k
5 votes
Accepted

Send structure through Serial

I tried the code from the link you posted and it worked: struct Gyro_data_structure { char command_name[6]; int gyro_X; int gyro_Y; int gyro_Z; }; struct Gyro_data_structure ...
Fahad's user avatar
  • 544
5 votes
Accepted

Arduino UARTS Auto addressing slaves

The first slaves will be plugged in and will send to the master his default address If this happens while the master is talking to one of the other slaves, you risk a collision. I suggest a very ...
Edgar Bonet's user avatar
  • 42.7k
5 votes

Serial.print skips or hangs inside a "if" statement. Trying to call a function VIA serial uart

High likely you are exceeding your character array, see: char a[5]; Which can hold 5 characters. However, you write: if(strcmp(a,"RGB_1") == 0) Which assumes you receive "RGB_1" ...
Michel Keijzers's user avatar
4 votes
Accepted

ESP8266 not able to communicate over serial connection with arduino UNO

The problem is in your loop() function. On each iteration, you will receive at most one character from the SoftwareSerial, while writing the same AT command again and again. As a result, your slave ...
Dmitry Grigoryev's user avatar
4 votes
Accepted

Can Arduino Leonardo use USB port and RX TX serial pins at the same time?

32u4 is multi-serial uC. USB connection works on default serial communication which can be used via Serial.print("somevalue"). On the other hand if you want to use RX/TX on pins 0, 1 which are ...
Sener's user avatar
  • 394
4 votes
Accepted

How do I know the IP address assigned to an ESP8266?

If you give your board a name with WiFi.hostname("MyESP8266"); (for example) you can then look on your router in the section that lists DHCP assignments (on my Netgear it's Attached Devices). That ...
Majenko's user avatar
  • 105k
4 votes

Double Speed Operation for USART on Arduino Mega 2560

When in double-speed mode, as noted in the manual, fewer samples are used. In Asynchronous serial communication, there is no clock signal, so the clock that keeps the two devices in sync is ...
jose can u c's user avatar
  • 6,974
4 votes
Accepted

Baud rate of Arduinos bootloader

The bootloader runs in the 328, and just as your application programs do, it sets a UART baud-rate for uploading programs to the Uno. Current bootloaders use 115200 baud for upload; the most recent ...
JRobert's user avatar
  • 15.2k
4 votes
Accepted

Arduino Mega reading same information that it's sending out via serial

I ran a slightly modified version of your test code on a Mega 2560 and got no echo at all; Unless I totally misunderstood your problem description, there must be something else going on. Here's the ...
starship15's user avatar
4 votes
Accepted

Standalone ATmega328P stops responding when RX is connected

There are two things wrong with the circuit in that demo. There is no decoupling capacitor on the power pins. This is required to keep the power stable during opertaion. More critically: this is ...
Majenko's user avatar
  • 105k
3 votes
Accepted

ESP8266 Programming using ESP-01 to USB converter

Finally I made a breadboard connection joining ESP8266's GPIO 0 and GND to Programmer's GND for flashing the chip For more info Additional Reference: Programming ESP8266
Arjun Sunil Kumar's user avatar
3 votes
Accepted

Accepting strings and integers via UART

As we don't know what you are using as a terminal program we can't comment specifically on your choice of EOL characters. It is likely you are receiving everything in ASCII code. That is, when you ...
st2000's user avatar
  • 7,315
3 votes

How to save a hex file into Arduino Flash to send it via Serial?

If I understand your question correctly, you need to integrate this data into a .ino script. Probably as a byte array. Then the script can read the array and Serial.write its content. You could ...
dda's user avatar
  • 1,588
3 votes
Accepted

UART communication issue on Arduino Mega

Serial.flush() only empties the output buffer, so that won't achieve anything. Reading exactly 9 bytes and hoping they match the input stream is not very effective, as you found. If you are out of ...
Nick Gammon's user avatar
  • 38.1k
3 votes

Single-channel serial communication

Bidirectional Asynchronous Serial schemes are not uncommon. The famous ones, like RS485, utilize special line drivers and differential signalling, but for short distances you can accomplish something ...
Chris Stratton's user avatar
3 votes

Capacitor Questions

Every active chip should have adequate decoupling. That is the point of C3, to provide decoupling for the MCU. It is required. While you don't need capacitors on the output of a non-existent ...
Majenko's user avatar
  • 105k
3 votes
Accepted

Stopping Serial on RX/TX pins while running Serial on USB

The Serial and Serial1 are two seperated ports. They are not connected. The Serial is the USB serial and does not use pin 0 and 1 at all. The Serial1 is the hardware serial port at pin 0 and 1, but if ...
Jot's user avatar
  • 3,246
3 votes

Solution for simple multi-Arduino communication network (or alternative?)

Thanks all for your answers. I did some more research with the new info you provided and found my perfect solution: TCA9548A. That's a 1-to-8 port i2c multiplexer that will allow the master MEGA2560 ...
Chefo's user avatar
  • 61
3 votes
Accepted

how to send data to Adafruit Bluefruit Feather (32u4) over bluetooth?

The “UART” being referred to is the Nordic UART GATT Service. This is not a serial port or USB connection. It is a high level BLE protocol that simulates a serial port via the Bluetooth connection. ...
RubberDuck's user avatar
3 votes

Control I2C relay board from two Arduino Uno

What you want is to operate in multi-master mode. This is a supported configuration of I2C - however the Arduino API has no support for it. It involves each master identifying if a collision has ...
Majenko's user avatar
  • 105k
3 votes
Accepted

How to use Serial.setTimeout()

The bytes are received to rx buffer with interrupt in the core. The find() function finds them there after the 500 millis delay. Timeout is to wait for the next byte if the rx buffer is empty. The ...
Juraj's user avatar
  • 17.9k
3 votes

I want my arduino mega to read from all 4 serial ports at the same time, running sequentially through each one

The Arduino already reads from the 4 serial ports at the same time. Or at least as close to “at the same time” as possible with a single CPU: every time a byte is received at one port, an interrupt is ...
Edgar Bonet's user avatar
  • 42.7k

Only top scored, non community-wiki answers of a minimum length are eligible