Questions tagged [array]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
41 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
159 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
25 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
52 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
28 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
1answer
81 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
42 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
86 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 ...
1
vote
0answers
21 views

printf spacing using array variables in unix shell script [closed]

I'm trying to use printf with a dynamic spacing but I'm not able to do that. I have this array containing the desirable spacing for each coloumn: Max_num=(); then I am trying to use numbers inside ...
2
votes
1answer
57 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
73 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
363 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
87 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
74 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 ...
0
votes
0answers
43 views

trouble finding peaks from pitch using IMU BNO080, 'array' was not declared in this scope not displayed

{ if (myIMU1.dataAvailable() == true) { float x1 = myIMU1.getGyroX(); float y1 = myIMU1.getGyroY(); float z1 = myIMU1.getGyroZ(); Serial.print(x1, 2); Serial.print(F(" &...
-1
votes
1answer
56 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
121 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
33 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
210 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
305 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
118 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
29 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
78 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
0answers
43 views

How could I combine sensor data with custom protocol und send it with Serial?

I am very new to Arduino. Now I am trying to send the sensor data to Computer. The sensor data will be stored as bytes into arrays. To build a robust transmission I'll pack the data with own defined ...
1
vote
1answer
40 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
157 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
80 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
113 views

arduino split string into an array [duplicate]

i have problem with change srting to array my string input is like this B109DAE1B71B638E it come from Serial.readString and i want to change this string to array byte like this byte in01[] = { 0xB1, ...
0
votes
0answers
44 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
42 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
27 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
487 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
293 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
219 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
358 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
33 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
543 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
363 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 ...
0
votes
1answer
63 views

Assigning an empty array row to reference [duplicate]

int colors[][3] = { { 255, 0, 0 }, { 0, 255, 0 }, { 0, 0, 255 }, { 253, 7, 210 } }; int (*EXCLUSIVE_COLOR)[3]; I have a two-dimensional array to store some color values. I have a 2nd ...
0
votes
2answers
76 views

Assigning an element of a multidimensional array to a second array

I have two arrays. The first array is a multidimensional array holding color values. The 2nd array stores an active color from the 1st array. How can I assign an element from the multidimensional ...
0
votes
2answers
169 views

ESP32 runtime error in 2d array

I am trying to serial print the value of b[0][0]. Has to be zero but it dose not work! Here is the code void setup() { Serial.begin(115200); byte b[321][241]; Serial.println(b[0][0]); } void ...
0
votes
1answer
130 views

Error taking address of temporary array when passing compound literal array

I have an Arduino sketch that passes an array into a method as a compound literal, but for some reason I keep getting the following error: void setup() { } void printConcatLine(char chunks[][20]) { } ...
1
vote
2answers
59 views

Nothing received from function returning array of strings

My read function returns an array of strings. i.e ssid and password String* configuration::read() { String rw_ssid = ""; String rw_pswd = ""; const int keys = 2; String read_ssid_pswd ...
0
votes
1answer
396 views

Getting error invalid conversion from 'const char*' to 'const uint8_t*

I have written this sketch, and I am trying to populate the array of wifi hotspots to set the value in html select using javascript dynamically. #include <Arduino.h> #include <Hash.h> #...
0
votes
1answer
56 views

Swap two arrays (using pointers, not copy)

I've got two arrays, defined as: uint8_t array1[10]; uint8_t array2[10]; I'd like to swap the arrays (actually the pointers to each array) using code like this: uint8_t *tmp = array1; array1 = ...
0
votes
1answer
379 views

Scrolling an I2C text

I want tried to make a programm to display a text on an I2C LCD-Display. The text should be scrolled for one position every time the function is called. On the internet I saw a lot of solutions but ...
0
votes
2answers
48 views

An array of existing arrays

I have a bunch of 3D arrays in the following form: byte lines[][4][2] { { {B00000000, B11110000 }, {B00000000, B11110000 }, {...
1
vote
1answer
91 views

Arduino Nano IoT 33 Char Array size constraints

I would like to save data that I am receiving from API calls in a char array. The problem is the data is around 80KB however my Arduino IoT 33 has 32KB of memory. It will save data in a char array ...
0
votes
1answer
33 views

Why when I pull an EEPROM index the value returned is garbage?

I have an array of colors for my tft screen: const uint16_t colorTheme [] PROGMEM = {BLACK, WHITE, NAVY, CYAN, RED, GREEN, VERDEAQ, PINK, ORANGE, PURPLE, GRAY, YELLOW}; When I try to use colorTheme [...
0
votes
2answers
36 views

Regarding Strings and assignments

I have this code which works : String ErrorMsg; ....... if(!UploadPacketError) { ErrorMsg="OK"; } else { ErrorMsg="NOK"; } String creates a dynamically allocated array which I want to avoid. ...

1
2 3 4 5 6