Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [array]

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

0
votes
0answers
35 views

How do I fix the error - Error: too many initializers for int[0] [on hold]

I'm trying to write a simple Library for a robot that I'm making and I'm getting errors I don't know how to diagnose - basically i made a battery monitor for the robot and added some status leds - but ...
1
vote
1answer
39 views

Does Arduino C++ support dynamic arrays of objects

My C++ is seriously out-of-date, and I'm working on a project that will be juggling multiple timed actions at the same time, with a menu system to manage the interface and control those timed actions (...
1
vote
1answer
25 views

Dynamic allocation/ Pointer to Pointer to update an Array containing parameter [closed]

topicArray defined as follows: const char* msgTopic = "Home/Messages"; const char* groupTopic = "Home/All"; char* deviceName = deviceTopic; const char* topicArry[2] = {deviceTopic, groupTopic}; But ...
0
votes
0answers
29 views

How to store an array of doubles? As array of doubles, Strings or const char *? Then convert back to use?

This seems like an old, solved problem, but I can't find any simple answers. I'm reading latitude and longitude data as Strings from a file (about 50 points), but they are really double float numbers. ...
0
votes
1answer
30 views

Message Interpreter and Handler - How to store a function name in a struct?

For a project, I need to store an array of structures in PROGMEM. Array MessageTable[] will be composed of about ten struct InMessage elements. InMessage looks sort of like this: struct AvcInMessage {...
0
votes
1answer
35 views

Stacks on arrays on arrays

I am trying to find a "vanilla" way of writing several arrays into one. I spent a lot of time searching for how to do this but everything that comes up is either a tutorial that doesn't cover ...
1
vote
1answer
43 views

Initialize and read from a PROGMEM array of pointers to PROGMEM arrays

I'm working on a project for the arduino uno for which I need multiple constant arrays of bytes. Such an array is initialized like so: const byte charR[] PROGMEM = { B01111111,//top half ...
0
votes
2answers
61 views

Assigning array variables to int variables

I need to control thousands of rgb leds.To make animations I want to assign led numbers(addressable led strip) to arrays.For example floor[2]room[14]=106 106 is the number of led,there are many floors ...
0
votes
1answer
41 views

Arduino Object Array initialization

I just got an Idea of trying to code rain simulation with arduino and Adafruit OLED display. When I finished it was quite messy code so I thought That maybe doing it Object Oriented would help. This ...
1
vote
1answer
36 views

Remove all items from an array [closed]

i'm trying to remove all the data i've in an array. Example: I've arr[5,3,2] and i want to clear the array totally and finish with an array like this arr[], ready to add new values. How can i do that?...
1
vote
1answer
46 views

Splitting a message

I have a string to be splitted into define chunks. For example new_str="abcdefghjklmnopqrstuvwxyz, and my goal is to split it to chunks of split_size=5, so the result should be :abcde,fghij and so o. ...
1
vote
1answer
38 views

Help with AlphaNumeric array

I have a Leonardo board and I want to set up my pins to input in one shot using a for loop but the problem is with the analog pins I can't see how to set up a mixed alphanumeric array it gives me some ...
1
vote
2answers
34 views

ArduinoJSON: Using a reference to a reference when parsing array of arrays

I started to play around with the ArduinoJson library to parse data I got from one of my APIs (the format of the JSON data I get from my API can be improved for sure, but the software I had to ...
1
vote
1answer
71 views

5 switches, 5 leds, 5 tones, in an Array

The idea is when a switch is pushed, the corresponding tone will be played as well as lighting up the corresponding LED. I have the circuit set up to where each array matches another, for example ...
0
votes
1answer
113 views

array to serial

i want to send an array of int to another arduino by serial. To garantie a better robust during the transmission, i added < and > with endMarker and startMarker. The receiver wait until the ...
0
votes
2answers
103 views

passing arrays via function returns wrong values [closed]

I am trying to use the values of an array in some other function, but when I return via a function the contents is wrong. This is the external function file I'm trying to use #include "Arrayreturner....
0
votes
3answers
57 views

Do some variables not hold their value when a while loop is exited?

Sorry if i'm asking too many silly questions but i'm really stumped on this one. I understand if I set a variable inside a loop that that variable won't be within scope from the outside of the loop. ...
1
vote
1answer
132 views

Can't create an array of type const char*

I have something being returned as a const char* and would like to save it to an array. I've tried this: const char* book[amtBooks] = ""; and get this error: error: array must be initialized with ...
0
votes
2answers
43 views

Arduino Serial Writing Array Problem

I am trying to communicate Pc - Arduino Uno. My Arduino code is here: (It is working as below) int ndx = 0; char pack[12]; void setup() { Serial.begin(9600); while(!Serial){;} } void ...
1
vote
1answer
38 views

Doubt using character array

I'm trying to make a led sign with a WS2812b ledstrip, using the FastLed library (by the way, this is a great library!), I'm already able to show a text (so far only one, which I leave saved in an ...
0
votes
1answer
27 views

Entire arrays are not read by Processing sent by Arduino unless cord is unplugged and plugged back in?

I am using an Arduino to read sensors and then send the data to the serial port for Processing to read. It works totally fine when I first download the code and run the Processing program. But if I ...
1
vote
1answer
171 views

Sending >255 bytes array to arduino

I am trying to send a 50x50 bitmap bytearray from my python client to arduino where it should be displayed on a screen. I need to receive 350 bytes to have the data to show the bitmap but as soon as ...
1
vote
2answers
2k views

How to change byte to int? - Arduino [closed]

I have searched everywhere, but can you please help me to get this Byte into int, there are alot of examples on the internet, but not for a beginer like me CODE: int Button[] = {2, 4, 7 }; byte E = ...
0
votes
1answer
41 views

String input to character array

I am in between of project where i am getting string like "hello world" via Bluetooth to arduino I want to list this string into individual character so that I can call any of the character when ...
-2
votes
4answers
748 views

How to find the index of the maximum value in an array? [closed]

Say we have an array named myMeasurements int myMeasurements[9]={3,4,8,12,7,2,1,67,8}; How can I find the index of the maximum element of this array? For example the MATLAB code would be: ...
1
vote
1answer
24 views

Runtime Error when using array of structs of unknown size as variable within class - some kind of overflow issue?

I have a class defined as below, it's basically a simple ring buffer, with some methods for getting useful statistics from the data held in the buffer. enum BalanceMsgType{ BAL_MSG_NOT = 0, ...
0
votes
1answer
112 views

Assigning Pointers to arrays - incorrect results?

I'm trying to build a transmission frame for a workshop library for the Arduino Uno. I have the byte frame inside an array, give it to another function that builds a bit frame and then want to ...
0
votes
1answer
298 views

How to send int[][] as a byte array through Serial

I have int arr[50][2]; and I need to send it through Serial. But I don't know how to do it. is it possible?
0
votes
3answers
626 views

How can I initialize an array of objects in setup?

How can I declare an empty global array, to be initialized in setup? What I would like to do is this: #include <ResponsiveAnalogRead.h> const size_t ANALOG_SIZE = 3; const int ANALOG_PINS[...
2
votes
2answers
77 views

Arduino receive response from SIM800H to AT+CCLK? command

I've been trying to make a program that interacts with SIM800H trough AT commands. It worked with the String class, but it was full of "memory leaks" and after a few hours it just hanged. Then I tried ...
7
votes
1answer
2k views

Why does Serial.print print only a value for 0-84 for a 100 integer array?

int a[100],i; void setup() { Serial.begin(9600); } void loop() { for(i=0; i<100; i++) { a[i] = i; Serial.println(a[i]); } exit(0); }
1
vote
2answers
204 views

How can I declare global array with its length stored in EEPROM?

I am working with Arduino UNO connected with BV4612 display. I am working on a simple code that controls several water pumps. Each pump has several modes it can run in. I store these modes in an array....
0
votes
1answer
49 views

Which container to use?

So for my project, I am measuring heartbeat of a person in a span of 10s. However, as the number of heartbeats may differ for each person, is it wise to use a vector?
0
votes
1answer
309 views

How to declare a Dynamic Array?

I want to define an unknown size for an array. However, I know that this cannot be done on the arduino. So what other methods do you suggest? I tried using vectors by downloading the library ...
0
votes
0answers
86 views

Overwrite image buffer (inside Adafruit SSD1306)

I'd like to add a method that replaces the entire image buffer into the Adafruit_SSD1306 library. I haven't worked with dynamic memory handling for ages and I'm not sure how to just simply overwrite ...
0
votes
1answer
51 views

Can't assign String to Array of String

I have to input 5 words and organize. In order to organize words, I have to get them into Array of String to compare. I succeed to get char[buffer] into String in_str but somehow in_str doesn't get ...
1
vote
3answers
520 views

Why does this array have stored values in it even though I have not put any values in it?

void alarm() { char keypressed4; char keypressed5; char keypressed6; char keypressed7; char disarmcode1[5]; Serial.println("hi2"); Serial.println(disarmcode1); The array gets declared ...
1
vote
2answers
439 views

Crosses Initialization in switch case with different size of array per case

void setup() { Serial.begin(9600); } void loop() { time_Text(2); } void time_Text(int PastTo_val) { switch (PastTo_val) { case 1: { int tPTT_y[] = {11, 11, 11, 11}; int tPTT_x[] = ...
0
votes
2answers
32 views

Error array value after passed to a function

I would like to ask about a weirdness in my program. This is my program: void setup() { Serial.begin(9600); } void loop() { workout_Text(); } void workout_Text() { int woT_x[] = {1, 4, 8, 12,...
0
votes
0answers
74 views

Is it possible to use an array to contain a list of strings that are to be passed as the parameters in a function?

I'm using the Blynk platform with my ESP-12E. Inside the Blynk Android app, I have a drop-down menu widget which can obtain the list of drop-down items from the microcontroller like this: Blynk....
1
vote
2answers
1k views

function returning String-Array

i'm still new to arduino and also to C++ and have a short question. What i want to do is to write a function (in my case to parse the query-string of an URL) to get the parameter names and values (...
0
votes
1answer
197 views

Selecting different arrays using a list of pointers

I have different arrays of different sizes, and a list of pointers to the addresses of each array. How do I select each array using the list of pointers, and access it's elements. On Teensy 3.2 board. ...
0
votes
2answers
851 views

Array, hexadecimal and serial write

I am trying to write a pice of code which send to a receiver the frequency to listen. As per its documentation, it should receive the following sequence: Example with 123.456 MHz Command to ...
-2
votes
1answer
522 views

Shifting items in an array [closed]

I want to move items inside an array. Ex. Array : 1 2 3 4 5 6 7 8 9 Shifted Array: a 1 2 3 4 5 6 7 8 How do I do that? Can I use memcpy for this?
0
votes
1answer
1k views

Printing char array from array of structs in progmem to serial

(I apologize if this is a c++ question, I'm too green to know if this is unique to the Arduino IDE) I've moved an array of structs into my PROGMEM because I was running into memory issues: #define ...
0
votes
1answer
33 views

Constants within array of structs causes strange compiler errors?

In my sketch I have the following: #define HU_ADDR 0x190; #define ALL_AUDIO_ADDR 0x1FF; #define MY_ADDR 0x360; #define UNKNOWN_ADDR 0xFFF; typedef ...
2
votes
2answers
1k views

How can I record a push button sequence and store it in an array

I have 3 push buttons and I want to record the sequence in which they are pressed in array of size 10,i.e, I want to record 10 values for example {1,1,2,2,3,3,1,1,1,3}. I want to blink an array of 3 ...
1
vote
1answer
1k views

Put integer and double into char array

I want to print text and numbers mixed in a table with Serial.print(); from a char array. My problem is the conversion between the different data types. My idea is to print the data of the rows in a ...
0
votes
1answer
346 views

Store values in array

I'm trying to implement the "BNO055 9 Axes Motion Shield". There is an existing Arduino sketch GitHub that reads out the Euler data, I changed it a bit to print out quaternion data. #include "...
1
vote
2answers
341 views

Use of array in case statement

I want to know how I can use case statement for each array. Below is my code: int incomingByte = 0; void setup() { Serial.begin(115200); for (int thisPin = 2; thisPin < 6; thisPin++) { ...