Questions tagged [array]

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

Filter by
Sorted by
Tagged with
0 votes
3 answers
67 views

Concatenate char arrays into a uint8_t array [closed]

I have the following global arrays: const char *prefix = "somePrefix"; const char *message = "someMessage"; I need to create a uint8_t array within a function that contains ...
RodrigoR's user avatar
1 vote
1 answer
162 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 ...
AlekseyFedorovich's user avatar
1 vote
1 answer
157 views

ArduinoJSON - How to check if array is empty

Parameters file defines the creation of entities and stored in flash. Its structure is given, and all fields ( keys & values ) are given. In current phase - those parameters are hard-coded in a ...
guyd's user avatar
  • 965
1 vote
2 answers
56 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 ...
JG98's user avatar
  • 21
-1 votes
3 answers
60 views

What is the best way to create a library from existing functions?

I was tasked to take functions that work, and create a library with these functions. Take a look at the following function that existed inside a program: char* Num_to_HEX_char_array(int32_t value) { ...
user1584421's user avatar
  • 1,371
1 vote
0 answers
84 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 ...
PNarduinouser's user avatar
0 votes
1 answer
59 views

Send a 2d PROGMEM array over SoftwareSerial

I have a 2d array: const byte messages_for_measurement[2][8] PROGMEM = { { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }, { 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10 }, }; I want to send ...
user1584421's user avatar
  • 1,371
1 vote
1 answer
82 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 ...
user1584421's user avatar
  • 1,371
0 votes
1 answer
77 views

Problem with character concatenation algorithm in matrix led

good afternoon, I am making a 7x10 led matrix in which I use a CD4017 to handle the 7 rows and 2 cascaded shift registers to handle the 10 columns. I first tried a programming to turn on my entire led ...
Lucio Mazzini's user avatar
1 vote
2 answers
171 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, ...
Andre's user avatar
  • 27
-1 votes
2 answers
156 views

Char array filling with blanks

When I run this code, my pin and pinCheck arrays are not being filled with the results of keypad.getKey(). If I print the value at each index, the result is blank. As far as I can tell, I am either ...
Ryan's user avatar
  • 3
0 votes
1 answer
71 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 ...
guyd's user avatar
  • 965
0 votes
1 answer
5k 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)...
dave's user avatar
  • 3
1 vote
1 answer
201 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 ...
Dashiell Rose Bark-Huss's user avatar
1 vote
0 answers
229 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 ...
Hadi Mirdamadi's user avatar
1 vote
0 answers
243 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 ...
Eric Walier's user avatar
2 votes
0 answers
83 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 ...
lucian_v's user avatar
0 votes
2 answers
912 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? ...
mehmet's user avatar
  • 277
2 votes
2 answers
3k 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 ...
voticoy's user avatar
  • 21
1 vote
1 answer
902 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....
mehmet's user avatar
  • 277
0 votes
2 answers
206 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!"); } ...
VinRocka's user avatar
  • 145
0 votes
1 answer
413 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. ...
Colby Johnson's user avatar
0 votes
2 answers
805 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 ...
Chris Schmitz's user avatar
1 vote
0 answers
489 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(...
alessandromrc's user avatar
2 votes
1 answer
120 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 ...
s_tatus3's user avatar
1 vote
0 answers
33 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 ...
Zhelyazko Grudov's user avatar
0 votes
1 answer
82 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 ...
LukasFun's user avatar
  • 295
0 votes
1 answer
1k 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 ...
leventecsoba's user avatar
1 vote
0 answers
245 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 ...
adrianton3's user avatar
1 vote
1 answer
288 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{...
Ethan Braun's user avatar
1 vote
2 answers
326 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. ...
E_Ja's user avatar
  • 21
2 votes
0 answers
94 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 ...
s_tatus3's user avatar
1 vote
1 answer
335 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, ...
C Vith's user avatar
  • 93
2 votes
1 answer
191 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 ...
AndroidV11's user avatar
1 vote
1 answer
472 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 ...
Ak Rikas's user avatar
1 vote
1 answer
553 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 ...
dogfood's user avatar
  • 51
1 vote
1 answer
447 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 ...
AndroidV11's user avatar
0 votes
1 answer
446 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,...
Chris Schmitz's user avatar
2 votes
3 answers
762 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 ...
Dema Govalla's user avatar
2 votes
1 answer
120 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(...
Boba0514's user avatar
1 vote
2 answers
2k 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 ...
Chris Schmitz's user avatar
4 votes
2 answers
9k 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 ...
iGEL's user avatar
  • 143
1 vote
1 answer
642 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 ...
John Rawls's user avatar
1 vote
1 answer
145 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 ...
FlipFlop's user avatar
-1 votes
1 answer
1k 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(...
guyd's user avatar
  • 965
1 vote
2 answers
475 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 ...
guyd's user avatar
  • 965
1 vote
1 answer
77 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 ...
Hitachii's user avatar
3 votes
2 answers
383 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 =...
Антон's user avatar
3 votes
3 answers
5k 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 ...
Moktar's user avatar
  • 31
0 votes
2 answers
1k 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 ...
NRav's user avatar
  • 225

1
2 3 4 5 6