Questions tagged [array]
Refers to code that present variables in the form of an array.
280 questions
0
votes
1
answer
82
views
How to modify the Leonardo's HID descriptor
I'm trying to make an Arduino Leonardo work with a PS4 following a similar approach as ArduinoXInput with its modified AVR core. However, even though I managed to add the device and configuration ...
0
votes
2
answers
106
views
Passing an array as an argument to a function [closed]
Please help how make it work.
int myArray1[] = {10, 11, 12};
int myArray2[] = {15, 16, 17};
void setup() {
Serial.begin(9600);
}
void loop() {
myFunction(myArray1); delay(1000); // i want to use ...
1
vote
2
answers
136
views
Is there a maximum length of an array in ROM?
Consider the following code:
#include <Arduino.h>
unsigned char testimage [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
...
1
vote
1
answer
411
views
stream a "big" array of measures to a server through wifi
I'm measuring accelerations at "high frequency" (4kHz) from an accelerometer (ADXL355/ADXL357) to an esp32. It's crucial that no sample is lost while performing a measure which last say 2 ...
1
vote
2
answers
118
views
Program to Multiply Numbers Won't Actually Multiply Them
I am trying to write a program which takes in a number of pairs to be multiplied, then prints out the result of each multiplication. Instead of doing this, the program just prints out the number of ...
1
vote
0
answers
129
views
Converting more strings from serial monitor to int arrays
I want to transfer 8 lists from a python script, via Serial Monitor to the Arduino. I can get the strings to Arduino and Arduino saves them as String array, but I can't change it to integer (it shows ...
1
vote
1
answer
280
views
Conditional assignment of array
I have some really long global variable arrays filled with data.
There is a single function that processes the data. The function works on only one array everytime. This arrays value changes every ...
1
vote
2
answers
229
views
Array of Functions
I'm new to C++. How to make a menu without if() {} else {} & switch() case?
I made a menu on an array, but for some reason it doesn't compile. How to correct it?
typedef void (*cbd)(uint8_t, ...
0
votes
1
answer
141
views
pointing to array of chars
I'm trying to pass a list of files (located in sketch) to be read using a library I write. List can have different filenames and vary in number of files.
How to pass a this array to my library?
for ...
1
vote
1
answer
344
views
Unexpected character added to char buffer array in serial monitor only when SD card initialized
I'm getting an unexpected extra character added to the serial monitor print line only when I initialize an SD card in the code.
Normal
The code below gives me this expected result in the serial ...
1
vote
0
answers
382
views
How to use an Arduino to play audio from an Adafruit Soundboard using audio file name
I'm trying to control an adafruit soundboard with my elegoo uno R3. I'm a beginner programer and I'm trying to get the soundboard to play a sound file by name when I press a button. I have confirmed ...
0
votes
2
answers
1k
views
Why I cant get sizeof a pointer Array
well I am trying to get array size to convert hex value to int value. but if I try to get size of array it returns every time 2. Actually .I dont understand. how to get array size, can you help me?
...
1
vote
1
answer
2k
views
How to convert a String to Hex array
I am trying use a HMI display. If I want to send a data, for example I want to write "TOPWAY" to 0x00000080 address it should like that:
Serial.write(0xaa); // packet head
Serial....
0
votes
1
answer
724
views
Seeking to write a ton of information to an SD card as close to live as possible
So I've recently started a project where I am using an accelerometer, along with a SD card breakout board. I've been able to get information to write properly to the SD card with no issues whatsoever. ...
1
vote
0
answers
854
views
Parse the data incoming from the buffer of Serial.readBytes()
I want to parse the data of the incoming buffer from the serial read bytes, but I don't really know how to get the data out of the array and save it to different variables.
This is my code:
void setup(...
1
vote
0
answers
57
views
Clicking a mouse based on dwell time / how to code a rolling total of sensor measurements
I'm trying to write code that should result in a click of the mouse, based on dwell time. I'm getting data from a gyroscope to move the mouse around. I'm not sure what the best way is to approach this ...
0
votes
1
answer
2k
views
How to send int array with ESP8266 http post request?
I'm reading RFID cards' UID with an ESP8266 and trying to send that information to my web server hosted on a Raspberry Pi. I'm currently storing the UID in an int array, but the http.POST(); function ...
1
vote
1
answer
523
views
Trouble initializing a struct array
The goal for this is to create a struct that includes a name, ID, fileName, and a boolean, then create an array of that structs.
Here's what I came up with:
struct Amiibo
{
char *aName{};
char *ID{...
2
votes
0
answers
119
views
Parsing read SD file into 2 variables
Recently I started some tests controlling water heater with temperature sensor data as described in detail here
So far I've been testing a small dataset to control water temperature that is quite easy ...
2
votes
1
answer
430
views
In multidimensional arrays, can you use variable arrays or their names instead of the actual data?
Referring to this thread
How to declare and use "Variabled arrays" inside arrays
Example
byte array[2][4] = { {1,2,3,4}, {5,6,7,8} };
Serial.println(array[0][2]); is equal to '3'.
Instead ...
1
vote
1
answer
954
views
using a variable to index an array
I'm using the keypad library to return a number 1-9. (im fairly sure this returns an int)
I have an array (data) showing the state of each button press.
so i would like the number returned by the ...
0
votes
1
answer
657
views
esp32 crashes when trying to dereference a pointer value
I have a websocket listener that is giving me a std::string of my message payload (I want the bytes) and I wrote a function that pulls each of the bytes out and puts them into 32 bit integer variables,...
2
votes
1
answer
168
views
Why are characters with value above 127 "padded" with 1s to be 16 bits long, while ones with values 0-127 aren't?
I am using the Arduino IDE to run and monitor, with an Arduino Nano clone.
This code shows what I mean by the question:
char foo = 127;
char bar = 128;
Serial.println(String(foo, BIN));
Serial.println(...
4
votes
2
answers
19k
views
Initializing Array of structs
I defined myself a struct:
typedef struct {
unsigned char current;
unsigned char start;
unsigned char target;
unsigned long startTime;
unsigned int duration;
} led;
I was able to initialize ...
1
vote
1
answer
195
views
Storing and sequencing output value (Arduino)
I am new to Arduino programming, after days and nights trying to use array and for loop, and googling a lot of articles, I am still unable to find how to store each weighing output value from int ...