Hot answers tagged

73 votes

Arduino Nano uploading gives error: avrdude: stk500_recv(): programmer is not responding

Know this is old but I ran onto it during my search for Nano(V3)'s not uploading so thought might help someone else. Problem is the bootloader - Arduino IDE BUT I Found an easy solution (right under ...
33 votes

What is the difference between Serial.write and Serial.print? And when are they used?

Serial.write is more down to earth , it is simple and fast, it is made to talk binary, one byte at a time. example: Serial.write(0x45); // will write 0100 0101 to the cable Serial.print in the ...
24 votes

Serial data plotting programs

There are some good applications for visualizing the serial data, including: MegunoLink ($39.95; Lite free) - plotting, logging, programming, reporting and more. Electric UI ($80; free for students) ...
24 votes

What is the difference between Serial.write and Serial.print? And when are they used?

From the Arduino site for Serial.write and Serial.print: Serial.write() Writes binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the ...
23 votes

What is Serial.begin(9600)?

A picture is worth 1000 words, so they say, (1024 words if you work with computers) so I'll post some pictures ... I set up my Uno to send "Fab" at 9600 baud and captured the results on a logic ...
  • 35.7k
20 votes

Can you use Serial Port as a variable?

Majenko's answer is the right answer for your question. But to answer the title of the question, if you ever need to use different Arduino outputs and inputs as variable, most of them have common type ...
  • 17k
20 votes
Accepted

Cannot program two arduinos at the same time because they both use the same COM port

I did not knew I could change the port on windows. This is how I did it thanks to @Majenko's comment.
  • 938
19 votes

How to retrieve the data type of a variable?

I use a simple stupid approach... // serial print variable type void types(String a) { Serial.println("it's a String"); } void types(int a) { Serial.println("it's an int"); } void ...
  • 199
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, ...
  • 2,009
17 votes
Accepted

How does serial communications work on the Arduino?

Asynchronous serial (usually referred to as serial) communications is used to send bytes from one device to another. A device could be one or more of the following: Arduino PC GPS RFID card reader ...
  • 35.7k
16 votes
Accepted

Only 2 decimal places in printed float

By default, the Serial print function shows only 2 decimals, however I'm sure the float has the full (unrounded) value, even if it does not show it. You can read about it in the official ...
15 votes
Accepted

Can I make the Arduino ignore serial print

If you insist on top performance, the best thing would be to use a macro for that: #define Sprintln(a) (Serial.println(a)) Then instead of Serial.println(F("Hello world!")); write Sprintln(F("...
14 votes
Accepted

Why is Serial.Write that slower when writing x+1 characters than when it is writing x characters?

The Arduino core has a 64 byte transmission buffer. Characters are sent out of that buffer by the hardware. When you blast lots of characters out of serial the first 64 just get put into that buffer ...
  • 104k
14 votes
Accepted

Can you use Serial Port as a variable?

Yes. The simplest way is with a preprocessor macro. Macros get replaced verbatim before compilation happens, so you can do something like: #define MY_SERIAL Serial void setup() { MY_SERIAL.begin(...
  • 104k
13 votes
Accepted

Arduino Nano no serial port for MacBook Air 2013

This solved it for me. Download this driver Install it Run sudo nvram boot-args="kext-dev-mode=1" Reboot Serial ports now showed up in the Arduino IDE and also when I used ls -1 /dev/tty* Hopes ...
  • 391
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&...
  • 39.2k
12 votes
Accepted

Put ATmega328 in very deep sleep and listen to serial?

A board we make does this. The RX pin is wired to INT0 INT0 pin set to input or input pullup depending on how the RX line is driven On sleep, INT0 low level interrupt is enabled //Clear software ...
  • 2,896
12 votes
Accepted

Low Power library messing up serial text

The problem is most likely that the system is going to sleep while it's still sending the serial data. Forcing all the serial data to be sent before you go to sleep should fix the problem (serial ...
  • 104k
11 votes

Use all pins As digital I/O

The main issue is with pins 0 and 1. Many pins have multiple functions assigned to them, such as A4 and A5 are also the I2C pins, pins 10/11/12/13 are also the SPI pins, etc. But pins 0 and 1 are ...
  • 104k
11 votes
Accepted

Arduino Convert std:string to String

Don't. Instead just access the underlying C string: Serial.print(F("Name -> ")); Serial.println(founded_dev.getName().c_str());
  • 104k
11 votes

Access serial monitor on linux cli? Using arduino-cli?

Programs such as screen, minicom or (my favorite) picocom are useful if you want bidirectional communication between the Arduino and the host computer. If you only want to read what the Arduino sends, ...
  • 39.2k
10 votes

What's taking up so much RAM in an almost empty sketch?

First off, a sketch that uses Serial cannot really be considered an empty sketch as Serial drags along a lot of function definitions, at least one Serial class instance (more on Arduino Mega, for ...
  • 8,915
10 votes

Two Arduinos Send data via Analog Pin?

This answer provides both Arduino specific knowledge and general electrical knowledge - both are necessary for a good solution (unfortunately). Summary To carry out Arduino analog to analog transfer:...
10 votes
Accepted

Serial Print, String And Variable On Same Line

int Var = 55; //Do it in 2 lines e.g. Serial.print("L "); // String Serial.println(Var); // Print Variable on same line then send a line feed
  • 938
10 votes
Accepted

Difference between /dev/ttyACM0 and /dev/ttyS0 (Arduino IDE ports under Linux)

/dev/ttyACM0 is a USB communication device (CDC) of sub-type "abstract control model" (ACM). That is what the Arduino is. /dev/ttyS0 is a hardware serial port - the (typically) 9-pin D connector on ...
  • 104k
10 votes

"'Serial' does not name a type" error

Your last two lines are not in any function. This confuses the compiler. You need to move those two statements inside a function. Because those statements refer to RawValue, I'm guessing you want to ...
  • 818
10 votes

Is it possible to make normal pins act like ground pins?

No, it's not going to work - even worse, you risk frying your Arduino -, for the following reasons: The Arduino data pins can't source (neither sink) enough current for that to work. The inductive ...
  • 2,103
10 votes
Accepted

Serial monitor can't display float and double values with absolute greater than 4294967040=2^32-2^8

It's not the data type, it's the printing routine that sets that limit. In Print.cpp: 227 if (isnan(number)) return print("nan"); 228 if (isinf(number)) return print("inf"); ...
  • 104k
9 votes

How do I know the sampling frequency?

I also wanted to get a high sampling rate, for a project. turns out that the ADPS2,ADPS1,ADPS0 bits of the ADCSRA register can be configured to get a sampling rate of 76923 s/s or 76.8 ks/s. But, ...
9 votes
Accepted

Arduino Uno not able to handle 2-dimensional array

2D arrays work fine on arduino, but you run out of space very quickly. An uno has 2 kilobytes of ram; your array has 56*96 = 5376 2-byte elements. I would guess that you are writing over some ...
  • 4,360

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