2022 Developer Survey is open! Take survey.

Questions tagged [array]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
35 views

How to append to array of Strings in arduino?

Here is my code: char *StrAB[] = {"29 EC C7 C1", "69 5B C9 C2", "22 3B 83 34", "12 BF BF 34", "C6 78 8E 2C" }; void setup() { Serial.begin(9600)...
user avatar
  • 3
1 vote
1 answer
40 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 ...
user avatar
1 vote
0 answers
78 views

increment or decrement the values of an array

I wanted to simulate the Dawn light with my arduino Uno using array implementation. I desired to change the brightness of the LEDs using fade effect( Smoothly and keep it unchanged until the next ...
user avatar
1 vote
0 answers
44 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 ...
user avatar
1 vote
0 answers
68 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 ...
user avatar
0 votes
2 answers
376 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? ...
user avatar
  • 205
2 votes
2 answers
782 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 ...
user avatar
  • 21
1 vote
1 answer
464 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....
user avatar
  • 205
0 votes
2 answers
81 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!"); } ...
user avatar
0 votes
1 answer
172 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. ...
user avatar
0 votes
2 answers
245 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 ...
user avatar
1 vote
0 answers
97 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(...
user avatar
2 votes
1 answer
96 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 ...
user avatar
1 vote
0 answers
24 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 ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
  • 315
1 vote
1 answer
542 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 ...
user avatar
1 vote
0 answers
83 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 ...
user avatar
1 vote
1 answer
82 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{...
user avatar
1 vote
2 answers
191 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. ...
user avatar
  • 21
2 votes
0 answers
72 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 ...
user avatar
1 vote
1 answer
198 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, ...
user avatar
  • 73
2 votes
1 answer
32 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 ...
user avatar
1 vote
1 answer
163 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 ...
user avatar
1 vote
1 answer
191 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 ...
user avatar
  • 51
1 vote
1 answer
148 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 ...
user avatar
0 votes
1 answer
231 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,...
user avatar
2 votes
3 answers
359 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 ...
user avatar
2 votes
1 answer
101 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(...
user avatar
1 vote
2 answers
818 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 ...
user avatar
2 votes
2 answers
2k 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 ...
user avatar
  • 123
1 vote
1 answer
309 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 ...
user avatar
1 vote
1 answer
95 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 ...
user avatar
-1 votes
1 answer
418 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(...
user avatar
  • 790
1 vote
2 answers
219 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 ...
user avatar
  • 790
1 vote
1 answer
61 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 ...
user avatar
3 votes
2 answers
262 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 =...
user avatar
3 votes
3 answers
2k 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 ...
user avatar
  • 31
0 votes
2 answers
487 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 ...
user avatar
  • 163
1 vote
1 answer
48 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 ...
user avatar
  • 163
0 votes
1 answer
172 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[...
user avatar
  • 790
1 vote
1 answer
57 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 ...
user avatar
0 votes
3 answers
358 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: ...
user avatar
0 votes
1 answer
223 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) ...
user avatar
  • 11
0 votes
0 answers
198 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 (...
user avatar
  • 790
0 votes
1 answer
183 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(...
user avatar
1 vote
1 answer
29 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 ...
user avatar
1 vote
3 answers
832 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 ...
user avatar
  • 19
0 votes
1 answer
865 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[] ...
user avatar
-3 votes
1 answer
772 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 ...
user avatar
1 vote
2 answers
3k 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 ...
user avatar
  • 11

1
2 3 4 5 6