Stack Exchange Network

Stack Exchange network consists of 175 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
1answer
32 views

How to programme a button per colour for a neopixel strip?

I am trying to make a particular pixel in a neopixel strip, turn green, red or blue depending which button has been pressed and to stay on until pressed off again (like a toggle), but currently when I ...
2
votes
2answers
178 views

Why does a variable size struct not compile in the Arduino IDE?

This sketch does not compile in the Arduino IDE void setup() { // put your setup code here, to run once: } struct test { int i; char variable[]; }; typedef struct test test; test t = { 0, ...
0
votes
0answers
25 views

problem with char array iteration and strcmp

New to Arduino and programming so forgive me if this is trivial but I've searched and can't find an answer... Goal: I want to convert decimal values to their equivalent fraction... eg: 0.125=1/8. I ...
0
votes
2answers
87 views

How to increase the serial port's data throughput

I have an array of numbers that will be subtracted from the ADC readings of a 50 Hz sine wave. Using Serial.begin(57600);, I can only output 25 samples per sine wave cycle, or about 1,250 samples ...
1
vote
1answer
21 views

Is new.cpp programmed improperly? Arduino 1.8.9

I'm having trouble with my code and I'm not sure if it's a memory allocation issue. So I look at the new, delete to see if it throws errors, and finding the source code I find outrageously simple ...
0
votes
0answers
34 views

sending array of data using spi

am using two arduino uno to start communicating using spi by sending an array of data but actually I having a trouble because the master is only showing me the first byte of the slave's array however ...
0
votes
1answer
40 views

Can't store RFID data in the next 5 bytes of array

I'm working on RFID project to handle multiple cards. I did most of the things OK. But now I have one problem. Which is the following: The RFID code is 5 bytes, so I need an array of 5 bytes. If ...
0
votes
2answers
51 views

Reading Digital Pins and Outputing on entire Ports

I'm very new to coding so please don't grill me. I'm working on a scientific project where I am using a NI-DAQ to digitally trigger mosfets to trigger 300us - 3ms pulses on two high powered LED ...
0
votes
1answer
32 views

Parsing array of an object in a library constructor

I am trying to develop an Arduino library that consists out of two classes. I want 'WayPointStack' to store an array of 'WPCommand', but I can't get it to work. WayPointStack.h #ifndef ...
1
vote
1answer
53 views

Passing arrays, global arrays within functions, pointers, and declaring array sizes

I'm super confused right about now! I've been working on project involving Xbees in API mode, and I need to send different arrays of bytes to the Xbee depending on which buttons I press. Mostly what ...
0
votes
0answers
41 views

How to put the inputs in array?

I face a problem and I really need help. For my Arduino project, I'm using RFID reader with tags. The story is, I have a desired arrangement for the cards and I defined it as an array called desired[]=...
0
votes
0answers
27 views

Problem: char string not working with SoftwareSerial.h

I am creating a program to display text on an OLED display and then have it sent to a thermal printer. The issue is my second char string: word_buffer When I try to use word_buffer for any reason it ...
0
votes
0answers
27 views

passing a char array referance to a methode of a class

I want to set a class for a sensor. One of the attributes of the sensor is an int array that I'd like to pass to a methode to store values in the array. The methode sould be able to write over ...
0
votes
1answer
33 views

Specific formatting of floats and converting them to an array of chars

I have an oled display which can only display 4 digits + decimal point. I need a way to format the number into 4 significant figures; Then I need to convert that into an array of 5 chars (4 digits and ...
0
votes
1answer
40 views

How to convert a delimited string of hex numbers to an int array

I am sending a string to the Arduino via serial, I made the program that sends the data, so I can change it to anything, but for now it sends a string of hex numbers delimited by ':', so for example ...
1
vote
2answers
60 views

Creating an array of structures which store bitmaps to work with u8glib

I've tried reading the documentations and I'm getting desperate because I can't find anything. I need to create an array of structures, which contains a bitmap stored in PROGMEM space (because of ...
1
vote
1answer
240 views

Length of uint8_t* const array

I've an array of type uint8_t* const with 6 items, defined like this uint8_t* const neighbourSet[] = {PEER1, PEER2, PEER3, PEER4, PEER5, PEER6}; Whereas each element in this array is static uint8_t ...
0
votes
0answers
59 views

two dimensional array

how can i store serial port available test to a two dimensional array. strings are separated with Z and end of text with # pls help if anyone alrdy a solution i am posting my program here String ...
1
vote
1answer
178 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
36 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
48 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
31 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
50 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
95 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
72 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
58 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
196 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
69 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
47 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
67 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
138 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
266 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
195 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
74 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
812 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
61 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
42 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
33 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
249 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
4k 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
66 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 ...
-1
votes
4answers
2k 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
27 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
240 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
448 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
1k 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
92 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
324 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
69 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?