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

learn more… | top users | synonyms

1
vote
0answers
27 views

Erratic behavior from 'randomly' generated values in array

Currently working on a data collection algorithm on the Arduino MEGA (ATMega1280) and I've run into a problem with some of the code I've written. I feel my problems may be stemming from the way in ...
1
vote
1answer
26 views

Using 2D servo array in my class

I need to use a servo library in my class. I read this question - Use object of other class within class and it works fine for my LCD application, but now I need to use a 2D servo array in my class. I ...
0
votes
1answer
26 views

two dimensional array with 3 characters per entry?

my plan is to create a two dimensional array with 3 characters in each cell. what i have tried: char keys[3][8][8] = { {' ','4','5','6','x','/',' ',' '}, {'x10','7','8','9',' ',' ',' ',' '}, {'...
1
vote
2answers
31 views

arrange vector in descending order

im trying to arrange the vector in descending order but its not happening.. int fibonacci[15]={0, 1}; int a=0; void setup() { Serial.begin(9600); for (int i=0; i<=14; i++) //loop to create ...
0
votes
1answer
58 views

Shrink array to save memory

In my project I need three arrays to store data inside. I define a maximal number of elements as a macro variable. However, at a certain point in the setup function, the program could determine, that ...
1
vote
1answer
32 views

Arduino SSCANF stop on comma delimiter

I have the following problem, the arduino is receiving a command like LCD,Display line text one, Display line text two I use an strcmp to match the beginning of the string that works but now I would ...
1
vote
2answers
32 views

How to keep track of if data is outdated

I have a large set of data and it is refreshed every 30 seconds or so. However, not all data is refreshed every time. It is possible that no new data for a particular calculation isn't received for ...
6
votes
2answers
106 views

Replacing several pinMode() and digitalWrite() pins with an array

I'd like to 'clean up' some code that involves several pinMode() and digitalWrite() lines by using a single line of an array. I'm very new to both arrays so I'm a bit confused. The following examples ...
0
votes
3answers
77 views

Returning an int array from a function

I have a function that needs to return 3 int values. I currently use an array declared in the global scope and I ask the function to write into them. Is there a way to make a function return an array? ...
0
votes
1answer
46 views

How can I use an arduino as an intermediary step between my PC and a LED strip?

Goal My end goal is to have a NeoPixel LED Strip that I can control via software on my PC, with various automatic modes and manual control. Right now all I have is the idea and some research done, ...
1
vote
2answers
24 views

Function only taking the first 4 elements of a character array

I'm writing a function for my arduino program that takes a character array of any size and will mark all the characters that aren't in the alphabet by changing their value to '1'. I have a switch ...
1
vote
1answer
30 views

Pass custom element of an array from an inherited class to main sketch

I'm building a base class that creates color patterns using FastLed's CRGB structure. I use the base class as inheritance for another more specific class that modifies a vector of colors (Pixels[]) ...
1
vote
2answers
35 views

Object Array using Inheritance

I would like to create an array of a generic type so I can use multiple sensors and make my code as extensible as possible. /* Planning for good design. Agent library should be able to use more ...
1
vote
0answers
32 views

RF24 - Split data in payloads at sender and then rebuild on receiving end

I'm trying to send some data using nRF24L01+ transceivers, but I need to use 8 byte payloads for reliability. The data I'm sending is much bigger than that, so I need to split it into 8 byte packets ...
0
votes
3answers
52 views

Arduino is freezing during Serial.Print() while passing a char array

This problem is on an Arduino Due. I am trying to populate a char array buffer that is receiving information over a serial port. I am reading the information off of the serial port and storing it into ...
0
votes
1answer
73 views

Best way to assign value to lot of variables

I'm building web based remote control system for esp8266. In arduino IDE, using the ESP libraries. To, send data to the server, I'm using http post. For some settings, I need to transfer 30 or so, ...
0
votes
1answer
63 views

MySQL Connector/Arduino insert data from row into an array

I'm new here. These days I have been working with the MySQL Connector/ Arduino library. So, my problem is how can i retrieve a rows data so as to enable an output. I have written some code, which was ...
0
votes
1answer
141 views

Size of String array

I am trying to find out the size of an array like this: String days[3] = { "Mon", "Tue", "Wed" }; Serial.printf("Size of array: %2d\n", sizeof(days)); for (int i = 0; i < sizeof(days); i++) { ...
0
votes
2answers
116 views

Using micros() to measure analogRead() time varies based on Serial.print location?

I'm trying to use micros() to measure the time it takes to execute an analogRead() cycle, but am having some issues. Originally, I just printed out the measured time for the analogRead() right after ...
0
votes
1answer
37 views

Passing array to library function

I'm trying to pass an array to a library (written in c++) but the error: undefined reference to `MyLib::arrayTest(int*)' collect2: error: ld returned 1 exit status Error compiling. Is being produced....
0
votes
3answers
75 views

How to pass a Static Cont array to a function

I'm implementing a voice synthesizer chip. To build a phrase, I create a list of phonemes like this: static const uint8_t PROGMEM heybuddy[] = { pPA5, pHH1, pEY, pPA5, pBB2, pAX, pDD2, pIY, pPA5,...
0
votes
0answers
27 views

Casting values larger than 0x7F as a CHAR

I'm writing some code and came across an odd issue. I was writing a checksum routine that accepts an array of chars and returns a char as the checksum value. I was testing the value returned by ...
0
votes
2answers
86 views

Dynamicly sized array as a class member

I want to create a dynamic sized array of chars as a member in a class. This is being done inside a library that I've created. I have the .h and the .cpp files created. I'm not sure how to declare ...
0
votes
1answer
270 views

Remove certain characters from char*

I've got an array of char* with serial data that I'm trying to remove ':' from. I have tried to iterate through the char*, find and remove any colons but it just comes out as garbage. char* espData[...
0
votes
2answers
17 views

Extracting a specific sequence of characters from an array

I have a character array called storebuffer that contains data from a POST submission and its in the format ssid=abcdef&pswd=ghijk. I wanted to extract everything after ssid= into one array called ...
1
vote
1answer
45 views

Overwritten EEPROM

I have a problem with the Teensy, its EEPROM and another Array. My program contains two Arrays, the first one is a 128x4 long Array, the other one a 2560x2 double Array. The first Array is meant to ...
-1
votes
1answer
70 views

Add string inputs into an array

I have been working on this a while and I cannot seem to figure it out. Essentially, I am using the app/server Blynk and their Terminal Widget to sent String inputs to my Arduino board. My code is ...
0
votes
1answer
35 views

Storing integer into character buffer

I have my Arduino code as below.I am trying to send Serial request and get response for it. I can able to send request mentioned in Setup function and also able to switch cases. Problem i am facing ...
0
votes
2answers
19 views

Character array weirdness

I'm using Energia to program one of TI's MCU. Since Energia is based off the Arduino IDE, I'm hoping someone can help me here. I'm building a simple UDP packet sender and receiver app. The MCU ...
0
votes
1answer
106 views

Arduino: put string through variable in array

I have a problem and I can't fix it. I'm busy with an java to arduino project. Java writes a string using writeString(); Arduino reads the serial monitor and put the incoming string into a function. ...
0
votes
1answer
34 views

Building Multidimensional Arrays from simple arrays

Hi I am trying to write a functiont that will build a 2x4 array based on 2 1x4 arrays. the two relevant functions are below. The first function gets information from some sensors and outputs it (I ...
0
votes
1answer
43 views

Is it possible to have an array of int arrays?

I have a huge number of arrays, each with a series of numbers each referring to an LED on a strip. I want to be able to address each one by a number, so the logical solution to that for me was to make ...
0
votes
2answers
115 views

How do I pass an Int Array into void for a foreach loop?

I know its probably an odd question...but I found a workaround for a foreach loop in C. I have a whole bunch of int arrays that I would like to be able to pass into a void, which has that foreach loop ...
0
votes
2answers
103 views

Using a button to cycle an array

So. I would like to cycle thru an array using a button. My current code goings thru if statements when the button is pushed. In each if statement I have a loop to print out a list of strings. I am ...
0
votes
0answers
22 views

Writing data into the array and its listing

I need to save the data to the Arduino array() at a certain time delay(500) and then have a second delay time delay(2000) that these data stored in array lists and arrays reset for the new store. How ...
5
votes
4answers
550 views

Employing C++ code for Arduino

I have Googled quite a lot regarding using a C++ program for uploading to Arduino and related, however I am confused now. Right, my problem is this: I have written a C++ program which imports RGB ...
1
vote
1answer
29 views

Why is the result shorter than expected when I do longString.toCharArray(bigCharArr, longLength)?

I'm running this on a Particle Photon, but I think the issue is just me failing at C++. I'm trying to retrieve some JSON data from a HTTP API, convert it to JSON, and then extract a few values for ...
0
votes
2answers
236 views

Removing Element From Array While Keeping Order

I'm building a wireless mechanical keyboard. There is an array of 6 elements that stores the keys pressed by the user (since 6 is the max number of keys you can send at once over Bluetooth). An ...
0
votes
2answers
86 views

Iterating an array of relays

Bear with me as I'm fairly adept at C# but I am having a problem understanding how to get an array iterated. I am writing a program to test relay boards, it will eventually have an input mechanism to ...
0
votes
1answer
107 views

How to convert array of chars to array of ints?

I have a rather newbie question but I can't figure it out. Lets say I have this char array: char array[] = "10,11,12,1,0,1,0"; How can I convert it to an array of int like this? int arrayINT[] =...
1
vote
2answers
64 views

Append Text to Variable Names: Please Help Me Shorten This Code

I'm trying to shorten the code under "setup" below, where I have over 120 variables that are being read from an external EEPROM. There is a pattern where the variable that stores the position of the ...
-3
votes
1answer
110 views

How do I learn C? (was Computer project) [closed]

Can you help me writing a code for this question guys?? You have an Arduino Uno with 8 LEDs connected to digital pins 2 to 9. Create an array of 8 elements. Fill it with random numbers between 2 and 9 ...
5
votes
2answers
530 views

Works with gcc, not with Arduino. error: taking address of temporary array

I need to hard code 8 byte addresses into char arrays of length 8. This must be done many places in my code (in function scope), so I have tried to come up with a one-liner. The following works ...
0
votes
1answer
173 views

Dot Matrix Display with Arduino UNO (PROBLEM)

hi guys i faced a problem in my graduation project and I hope you can help me to solve it :) ... my project is connecting Arduino uno to 16x32 Dot Matrix Display(DMD) and display messages on it from ...
0
votes
2answers
388 views

Iterate an Object Array

I'm trying to create an array of objects and later iterate over it and do something with each object. My C++ skills just don't go far enough. Here's what I have so far. I've tried to strip out all ...
2
votes
2answers
2k views

How can I pass a char array as the parameter to a function?

I am creating a menu for adjusting system variables. The menu is made up of pointers like so: char* options4[] = {"hMin1", "hMax1", "refr1", "fSpeed1"}; I want to pass the selected string as the ...
0
votes
1answer
2k views

Copy content of array

This may be an easy question, and if so im sorry, but i couldn't find out how to do this. I've programmed in python before and hoped that this would work, but it don't. int myArray1[] = {0, 2, 4, 5, ...
0
votes
1answer
318 views

Why I cannot change array values even if a statement is successfully called? TFT Touch Screen

#include <Adafruit_GFX.h> // Core graphics library #include "LGDP4535.h" // Hardware-specific library #include <zTouchScreen.h> #define BOXSIZE 40 // Assign human-readable names to ...
0
votes
2answers
41 views

Declare for loop as an array of variables [duplicate]

My goal is to store the variable in the for loop as an array rather than as a single 'ultrasoundValue'. Can some one help me structure the code? I have this code: int ultraSoundSignalPins[] = {5,7};...
0
votes
4answers
237 views

Array of Strings and Callbacks

I am trying to create an array of structs that contain pairs of Strings and Callbacks the problem I am having is assigning the callback function. I have the following code: #define UI_ROUTINE_ITEMS ...