Hot answers tagged

19 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, ...
user avatar
  • 1,964
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&...
user avatar
  • 35.5k
9 votes

How can I communicate Raspberry Pi and Arduino (in both ways) using a 10-15m distance wires?

for length such as this, you should be using protocols that are designed for length, such as: UART, CAN, Ethernet for UART, you can't of course use a direct connection between the two boards, you ...
user avatar
  • 1,488
6 votes
Accepted

Is there a transmission protocol library for SPI?

Each spi peripheral has its own protocol in the sense of commands and addresses if any and data. Spi simply makes a common ground for chip select vs clocks and clocks vs data and separate miso and ...
user avatar
  • 186
6 votes

Super slow serial (UART) communication on Arduino

I think the problem is not so much in the update speed, but in the fact that you loose accuracy in your calculation. The following lines are the culprit: int kphValue = 0; // [-32768:32767] int ...
user avatar
  • 2,831
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 ...
user avatar
  • 101k
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 ...
user avatar
  • 1,130
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 ...
user avatar
  • 35.5k
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 ...
user avatar
  • 335
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 ...
user avatar
  • 101k
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 ...
user avatar
  • 382
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" ...
user avatar
5 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 – ...
user avatar
  • 35.5k
4 votes
Accepted

Code to use an Arduino Mega 2560 to transfer UART <-> USB to debug an other Microcontroller

A very simple sketch to pass serial through looks like this: void setup(){ Serial1.begin(/*BAUD*/); Serial2.begin(/*BAUD*/); } void loop(){ if(Serial1.available()){ Serial2.print((char)...
user avatar
  • 4,299
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 ...
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 ...
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 ...
user avatar
  • 101k
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 ...
user avatar
  • 6,922
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 ...
user avatar
  • 14.4k
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 ...
user avatar
4 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 ...
user avatar
  • 35.5k
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 ...
user avatar
  • 101k
3 votes
Accepted

Custom Arduino library problem

uart::uart(void); That's a prototype, not a function. It needs a body. Also, using "void" to say "no parameters" is really confusing. Better to leave it out all together. uart::uart() { } uart....
user avatar
  • 101k
3 votes
Accepted

What protocols and tools does Arduino Due use for flashing and debugging?

The Due (more specifically the SAM3X) uses its own proprietary protocol. It's all embedded in the bootloader, which is hard wired in the ROM and can never be changed (idiotic if you ask me). I know ...
user avatar
  • 101k
3 votes

Super slow serial (UART) communication on Arduino

try this: #import <Arduino.h> #include <OBD.h> int kphValue = 0; int rpmValue = 0; COBD obd; //array of character arrays, see http://arduino.cc/en/Reference/string const char* ...
user avatar
  • 508
3 votes
Accepted

Cannot control servos through 32-servo-controller on Aurduino Duamilanove

There is one connection missing - the one that powers the servo and board. At the moment your servo board is getting a small amount of power through the RX pin - disconnect it immediately, you are ...
user avatar
  • 101k
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 ...
user avatar
  • 6,441
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
user avatar
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 ...
user avatar
  • 1,543
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 ...
user avatar
  • 35k

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