4
votes
Accepted
Arduino IDE equivalent to DataView?
There is no use for a DataView in the Arduino environment. In the
JavaScript language, a string and an array of bytes are two very
different things. That's why you need something like this str2DV()
...
4
votes
Accepted
What is the minimal possible latency between arduino and PC
There is more to low-latency communication than just squirting data as fast as you can (though that is an important part of it).
One thing people often forget is that the Arduino can only (easily) do ...
2
votes
What causes Serial.available() to become false after Serial.read() gets data?
It is an internal buffer and only the pointer gets increased. It it visible in the source code off the project, located on github:
// Read data from buffer
int SoftwareSerial::read()
{
if (!...
2
votes
Accepted
Buffer reverse to string
You can do it with snprintf_P:
char mac[18];
snprintf_P(mac, 18, (PGM_P)F("%02X-%02X-%02X-%02X-%02X-%02X"),
report->peer_addr.addr[5],
report->peer_addr.addr[4],
report->...
2
votes
Is Arduino Mega useing one buffer or multiple buffers?
Actually there are 2 buffers per Serial hardware interface: The hardware buffer, that is 1 byte (per direction of data transfer). The Serial library then transfers this byte in an extra buffer (64 ...
2
votes
What is the maximum size of Static Json Document in Arduino JSON?
The Arduino Mega has 8 KB of RAM, all of which you could use in a StaticJsonDocument.
The ESP8266 has 80 KB of RAM, but the core limits the stack to 4 KB. If you need something bigger, switch to a ...
2
votes
Accepted
Unexpected character added to char buffer array in serial monitor only when SD card initialized
const int BUF_DIM = 3;
char inputString[BUF_DIM];
...
inputString[0] = 'a';
inputString[1] = 'b';
inputString[2] = 'c';
...
Serial.println(inputString);
You have allowed three characters ...
2
votes
Arduino interrupt for serial data on digital pin, that is too large for the serial buffer
GPS is a really slow communication, it communicates in 9600bps and data only available once in every second. Any MCU running at much slower than an Arduino Uno running at 16MHz should be able to ...
1
vote
Accepted
How to faithfully collect geophone data by modbus RTU?
With the help of Github copilot and a bit of editting this code does the job. First the signal is averaged over 1000 readings. Then the absolute value is reported above an average of the baseline. ...
1
vote
Serial Buffer stays empty as soon as it becomes empty once
I second Nick Gammon in recommending a time-based condition, rather than
counting the loop iterations. You can do it in a non-blocking fashion
though:
keep track of when was the last time you ...
1
vote
Accepted
How to optimize checking for specific string in a UART stream
Here is an idea that may work: instead of buffering the input stream
and comparing the buffer with the search string, you could do the
comparison on the fly, as you receive the characters. Then you ...
1
vote
Accepted
Problem cleaning string read from serial buffer
When sending text commands to an Arduino, it is common to define a
“line-oriented protocol”: each command is transmitted as a single line,
with the line ending signifying the end of the command. ...
1
vote
Accepted
Elements excluded from buffer array output after given structure (ESP8266 WifiSniffer) (snifferPacket)
What do each of the 12 elements represent?
Things in the header. That is off-topic for here.
Why is there a difference in the output between the output of the raw buffer and snifferPacket?
...
1
vote
Clearing string buffer with memset after a serial read
Thanks for the pointer - that did the trick. Applying it to my original code, if I update the few lines around handle call from Python to the following, it works as intended.
////////////////////...
1
vote
Is Arduino Mega useing one buffer or multiple buffers?
Every instance of class HardwareSerial has own buffers. Here you can see it in source code. The instances are declared/definded at the end of the HardwareSerial.h/.cpp.
1
vote
Accepted
writting to buffer from serial input
A byte can only contain values from 0 to 255 (including).
So my guess it works for values until 255.
You should use a different type, e.g. unsigned int or unsigned short.
for (unsigned short i = ...
1
vote
Error handling strings and chars
toCharArray is alias for getBytes. getBytes is documented as "Copies the String’s characters to the supplied buffer." You did not allocate the memory for the copied characters.
the right use of '...
1
vote
Accepted
How to transmit string data using the rc-switch library?
The communication protocol used by this library is unreliable. Thus,
each code word is sent multiple times, 10 times by
default. One solution around this problem is to send
a “byte number” along with ...
1
vote
Accepted
Communication with socketserver fails after specific number of packets
I found my stupid mistake:
By using try without catching specific exceptions (I know one shouln't do that) in my Laptop-Server script I didn't recognize that I was trying to send unencoded strings.
So,...
1
vote
Communication with socketserver fails after specific number of packets
close the disconnected socket before reconnecting
if (!client.connected()) {
client.stop();
client=TCPserver.available();
}
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
buffer × 27serial × 11
esp8266 × 5
arduino-ide × 4
string × 4
arduino-uno × 2
esp32 × 2
bluetooth × 2
interrupt × 2
softwareserial × 2
sd-card × 2
array × 2
web-server × 2
uart × 2
serial-data × 2
pointer × 2
arduino-mega × 1
programming × 1
arduino-nano × 1
sensors × 1
i2c × 1
wifi × 1
library × 1
spi × 1
arduino-leonardo × 1