Questions tagged [array]

Refers to code that present variables in the form of an array.

Filter by
Sorted by
Tagged with
1
vote
0answers
16 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 ...
1
vote
0answers
66 views

Store and processing about 30000 values read in 30 seconds

I am reading an accelerometer using an esp32. interval = 30000; (30 sec) offsetx, offsety and offsetz are values calculated on another function which I am using to calibrate it. If I do like this I ...
0
votes
2answers
141 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? ...
2
votes
2answers
386 views

Printing the array using print and serial write function in Arduino Uno

I have, one program with only using printing array and other with serial write and print function for the array, while using serial write and print function I get these extra characters between the ...
1
vote
1answer
331 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
2answers
57 views

Arduino Serial Monitor Input 3DES Encryption

I am trying to 3DES encryption using Serial Read, Found this 3DES Sample code in Github, #include <DES.h> DES des; void setup() { Serial.begin(9600); Serial.println("Hello!"); } ...
0
votes
1answer
100 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. ...
0
votes
2answers
111 views

Passing a two dimensional array to a function

I'm working on an led matrix project where I'm running a series of patterns made of bitmap frames. Here's an example: https://vimeo.com/564184465 Right now I'm using a series of method calls named per ...
1
vote
0answers
45 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(...
2
votes
1answer
94 views

Error trying to simulate temperature dynamically

I'm trying to simulate dynamic temperature using a small set of data with ESP32. I've just realized that the relay doesn't change the status if there is some variation of the temperature upper or ...
1
vote
0answers
23 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
1answer
45 views

Global array doesn't get assigned the space it would take up in memory

I have this sketch: const uint32_t len = 65536; uint8_t arr[len]; void setup() {} void loop() {} The length of the array should fit into the dynamic memory. However, when I compile the sketch it ...
1
vote
1answer
242 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
0answers
52 views

Can data be stored in program storage space instead of dynamic memory?

I'm declaring an array at top level like so: constexpr byte a[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; // whatever data I'm referencing the array in such a way that it's not optimized away. When ...
1
vote
1answer
61 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{...
1
vote
2answers
114 views

Would someone provide an example of extracting data from a char array?

I have tried so many things now that I am just confused. I am not understanding the way char arrays work. I can't get the date and names extracted. And when I use just strings, I jam up the memory. ...
2
votes
0answers
69 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 ...
1
vote
1answer
173 views

Hexadecimal array does not add up as expected

I have an array of hexadecimal values as given below. byte Hexa_Val[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; I want to increase this array from the end. As in, go from {0x00, 0x00, 0x00, ...
2
votes
1answer
28 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
1answer
83 views

lcd byte array display

when reading RFID(MIFARE) information using Arduino mega and display in serial monitor it works fine. But, when printing on 2004LCD only one information(Value) displays correctly. The other ...
1
vote
1answer
99 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 ...
1
vote
1answer
96 views

Can you create an array for functions? [closed]

Let's say I want to create 10 functions, named Function1, Function2 until 10. Each function is used if a certain variable is equal to its number. Rather than using individual functions, I was ...
0
votes
1answer
141 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
3answers
241 views

Collecting data from a timer interrupt and storing it into an array

My question is: how can I use an ISR and store the data I get from my analog inputs into an array for easier data analysis. More specifically, I want to collect my data using an ISR function (internal ...
2
votes
1answer
88 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(...
1
vote
2answers
401 views

strcmp doesn't seem to work

I'm trying to compare a char array that I'm assembling to a string and I'm having trouble comparing the strings. I'm getting the data for the char array as a set of bytes and I'm compiling it into a ...
2
votes
2answers
1k 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
1answer
174 views

How to add two assembly arrays in arduino

Hey guys what I'm trying to do is to sum two arrays and return a new array; for example if given uint8_t a[] = {2, 4, 6}; uint8_t b[] = {1, 2, 3}; I should get { 3, 6, 9} What I'm trying to do is ...
1
vote
1answer
86 views

Storing and sequencing output value (arduino)

I am new to Arduino programming, after days and nights trying to use array,for loop and googling a lot of article, I still unable to find the way how to store each weighing output value from int ...
-1
votes
1answer
221 views

RF24- Splitting and sending a longer than 32 byte payload

In order to send a long payload I've created the following function: void splitMSG(const char *msg, const int arraySize, const int len) { Serial.print("Array size: "); Serial.println(...
1
vote
2answers
164 views

Unexplained behavior of char array after using `deserializeJson`

I'm using RF24 library to send messages between 2 MCU's : 1) ESP8266 (no Wifi, same code can be compiled to any Arduino board) 2) pro-Micro. Message is sent in JSON format, while using ArduinoJSON ...
1
vote
1answer
47 views

Merging two 2-d arrays in order of axes

Looking to merge two different 2D arrays of different row sizes into one long array: int 2dArray1[][] = { {1, 2, 3}, {4, 5, 6}}; int 2dArray2[][] = { {10, 20}, {30, 40}}; int ...
3
votes
2answers
227 views

Form a signal from an array of bits

I need to reproduce with a digital pin of an Arduino such a key in the form of a sequence of 1's and 0's, where a one takes 2 ms high and 2 ms low, and a zero takes 1 ms high and 1 ms low. int key =...
3
votes
3answers
1k views

How to get the sizeof array of structs

I'm trying to make a use of a relay module, I want a clear way to configure and control my relay module I've defined the struct and filled it with some info about id, pin number, title, and relay ...
0
votes
2answers
344 views

Float array to comma separated string

I have a loop command reading temperature sensor data from 8 thermistors and are storing them as floats into an array. Instead of printing to Serial on each iteration, I would like to create a comma ...
1
vote
1answer
40 views

iterate through 8 thermocouple sensors (MAX31856)

I have 8xMAX31856 and I am trying to use the Adafruit library. Instead of writing all 8 thermocouple channels each time in code (and wasting memory), I want to store the objects in an array and loop ...
0
votes
1answer
134 views

Passing a time_t array as a function parameter

I'm trying to log reconnections and disconnections of a network. For that I've created 2 time_t arrays to store such occurances: const int logSize = 10; time_t conLog[logSize]; time_t disconLog[...
1
vote
1answer
51 views

Arduino array error

I'm writing a program that has a sub program that saves values to an array, but the sub program that saves the values to the array comes back with an error telling me that the array isnt declared in ...
0
votes
3answers
242 views

What's the most direct way to assign Serial.read() bytes to an array?

I'm trying to send NMEA 0183 sentences through LoRa. Every dinstict NMEA message looks like several char arrays (sentences) followed by '\n'. In the below picture we see one NMEA distinct message: ...
0
votes
1answer
150 views

Best strategy to parse 5 byte arrays to find a pattern

Ok here it goes, my first ever question posted to stackexchange! Please be gentle on me! I am using an Arduino UNO (at the moment, will move to a faster micro later - but still use an Arduino sketch) ...
0
votes
0answers
97 views

Size limitation on char Array on ESP8266

I'm creating a log of events, stored as a txt file. If it matters, I'm using ESP8266. To display the log of each IOT, I'm publishing the txt file to a disgnated MQTT topic for all my IOT devices (...
0
votes
1answer
128 views

String array length in function

I know this question has been asked a thousand times, but I can't find a solution for my case. I what to get the length of a string array in a given function. This is for an arduino board. #define LEN(...
1
vote
1answer
28 views

Check if any of loop's insides returns 1 and hold it until the whole loop is 0 again

I'm new to this, so, please, don't crucify me. I have a function that checks if an entry in multilevel array is in a certain range. Using FOR loop I check the whole array with this function, which ...
1
vote
3answers
708 views

using a switch case with a 5-position switch and serial output

I'm trying to get started on developing a menu system for my LCD1602. I have a Parallax 5-position switch (up,down,left,right,center) and I would like to interface the two. I've been trying to get ...
0
votes
1answer
642 views

How can I assign the value of a char array to a uint8_t array?

I have a char array variable that has a value. I need to send this value through LoRa. The library I use for the LoRa implementation accepts an array of uint8_t. How can I pass the value of a char[] ...
-3
votes
1answer
527 views

Any limitation on array size in Arduino Mega 2560?

I am writing an Arduino code with 3 arrays. Two of those are double and other one is int. Further first two arrays have nearly 420 elements for each. Now I noticed that with more that 89 elements on ...
1
vote
2answers
1k views

How do you remove an item from array arduino?

Is there a way that can change {3, 5, 3, 6} to {3, 5, 6} with a function? I checked all the arduino forums but they don't give the answer i need (just delete 1 item from an array with a function like ...
1
vote
1answer
38 views

How do you make a Class variable array bigger?

I am making an infrared macro-keyboard, I want to store Unicode for the Keyboard class in an array inside a class I made called Keybindand to allow the user to program as many outputs as they want, I ...
1
vote
1answer
839 views

Need help with EEPROM not storing array values on ESP8266 after restart

I am struggling through a program. I am trying to store my uploaded string into an array then write that array to EEPROM. I run the program, upload the new array and store it in the EEPROM. all values ...
0
votes
1answer
616 views

Setting an array pointer to null on declaration

How can I set an array pointer to null? I have a pointer to a 3 int array that I am trying to set to null. int (*EXCLUSIVE_COLOR)[3]; Per this link I was trying to set it to null upon ...

1
2 3 4 5 6