All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
342 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
3 answers
776 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
3 votes
2 answers
388 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
0 votes
3 answers
636 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: ...
BrainTrance's user avatar
0 votes
1 answer
1k 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[] ...
BrainTrance's user avatar
0 votes
1 answer
172 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 ...
VerySeriousSoftwareEndeavours's user avatar
0 votes
1 answer
2k 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> #...
Ciasto piekarz's user avatar
0 votes
1 answer
67 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 [...
luke cross's user avatar
0 votes
2 answers
6k views

Declaring and using array of structures in Arduino

Printing structure variables, I get default values. What is wrong with my code? struct SCENARIO { int Lamp_Pin = -1; int PB_Pin = -1; } ; SCENARIO _red; SCENARIO _yellow; SCENARIO _white; ...
BHP's user avatar
  • 109
0 votes
1 answer
111 views

Creating an array with the length coming from a library

When creating an array like in the sketch #include <Lib.h> int myArray[Lib::len]; void setup() {} void loop() {} the variable len must be an integer constant that is known at compile time. ...
LukasFun's user avatar
  • 295
1 vote
1 answer
13k views

Error: invalid application of 'sizeof' to incomplete type 'int []' when trying to compute the size of an array in a library

I have created a library that contains an array. This is the .h file: class Lib { public: static int arr[]; }; And this is the .cpp file: #include "Lib.h" int Lib::arr[] = {0, 1, 2, 3}; ...
LukasFun's user avatar
  • 295
0 votes
1 answer
344 views

Expected unqualified-id before 'public'

I'm making an arduino program for a buzzer that you can record notes and song for and then play them back. I have 2 arrays that hold both pitch and if a note is being played. I continue to get errors ...
Techno Taco's user avatar
2 votes
1 answer
1k views

How to scale a bitmap (uint8_t array) in Arduino?

So I have a project where I send text to an Arduino, which is then printed out as a QR code on a thermal printer that can take a bitmap image with a given width and height. Is there a way I can "...
Tony Sesek's user avatar
1 vote
1 answer
1k views

Merge two 8 bit arrays to one 16 bit array

I am an absolute newbie to Arduino and C++ and try to go through some tutorials to gain a minimal insight. However I stuck already at some tiny Points. What I want to do? Merge two 8 bit integer ...
Nikolaij's user avatar
2 votes
2 answers
2k 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, ...
the_architect's user avatar
1 vote
1 answer
37 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 ...
Enrique Mendez's user avatar
1 vote
2 answers
676 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 ...
OM222O's user avatar
  • 199
2 votes
1 answer
3k 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 (...
Duncan C's user avatar
  • 5,622
2 votes
1 answer
62 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 ...
guyd's user avatar
  • 975
1 vote
2 answers
3k 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[] = ...
Zahi Azmi's user avatar
0 votes
2 answers
37 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,...
Zahi Azmi's user avatar
2 votes
3 answers
476 views

for loop running infinitely

void writereg() { digitalWrite(latchPin, LOW); for (int i = 7; i >= 0; i--) { digitalWrite(clockPin, LOW); Serial.print("wswitch&&&&&&"); Serial.print(i); ...
bukke hari prasad's user avatar
0 votes
2 answers
4k views

Max length of char arrays?

I'm running the following Sketch on my Arduino Uno: const boolean verbose = true; void debug(const char *s){ if(verbose){ char buf[8 + sizeof(s)] = "[DEBUG] "; strcat(buf, s); ...
tr01's user avatar
  • 117
0 votes
1 answer
795 views

Space needed for local String variable

I tried to run this code on my Arduino Uno clone (which has no function so far and is a shortend version of my programm): String rules [16][5] ={ {"B0 B5", "", "", "cs S0", "", }, [...] }; ...
tr01's user avatar
  • 117
1 vote
1 answer
1k views

Select from Custom Array without Repeat

I found this great code to pick a random number from a "hat" without repeat: /* RandomHat Paul Badger 2007 - updated for Teensy compile 2017 choose one from a hat of n consecutive choices each ...
DonDrape's user avatar
1 vote
3 answers
10k views

Convert string into char array in Arduino?

I am not that great at Arduino and C++ yet, but I'll give this a shot: I have a char array that looks like this: char PROGMEM bitmap[] = {0xD7,0xED,0xEF,0xFF,0xF6,0xEF,0xFE}; However, I receive ...
MortenMoulder's user avatar
1 vote
2 answers
3k views

Updating Array Values Incrementally Overwrites The Existing Values, Why?

I have a global array. I'd like to update the array while the program running. But, I've found that my program below doesn't work as I expected. Please checkout the program source: #define ...
Oki Erie Rinaldi's user avatar
1 vote
1 answer
768 views

Utilizing Array with RGB

I am trying to create a sketch that utilizes two arrays, one array to hold five buttons as input, assigned to pins, and another array to hold five musical notes. I have attached a RGB LEDs with pull-...
Trevor's user avatar
  • 13
1 vote
1 answer
48 views

waiting for a set number of inputs in an array to be reached

How do i have code wait for an x number of inputs be reached in an array before doing anything else? int largestindex = 0; int learnindex=0; void MyHandleNoteOn(byte channel, byte pitch, byte ...
Hjhk90's user avatar
  • 291
1 vote
2 answers
5k views

comparing the entries of two arrays

i am trying to compare the elements of two arrays before the code goes on to the next sequence. The elements of note[x] are filled with the note values of a song. and i want to be able to input values ...
Hjhk90's user avatar
  • 291
1 vote
1 answer
119 views

Can you pass the entries of a strut array to a int array? if so how?

typedef struct { uint8_t pitch; }LearnNote; #define MAX_NOTE 500 LearnNote Noteseq[MAX_NOTE]; int learnindex=0; void loop() { MIDI.read(); } void MyHandleNoteOn(byte channel, byte pitch, ...
Hjhk90's user avatar
  • 291
0 votes
1 answer
1k views

How can I store the received data from nRF24l01+ module in an array (code in description)?

This is my sample RX code for 4 Tx and 1 Rx nRF24l01+ modules. I want to store all the data received from 4 pipes into an array (recArray). #include <SPI.h> #include <nRF24L01.h> #include ...
user5311361's user avatar
0 votes
2 answers
52 views

Function is executing when I try to store it in an array

I am trying to store a set of functions with different parameter in an array. When the code enters the function songlearn with tune==1 I want the functions with set parameters to be stored in the ...
Hjhk90's user avatar
  • 291
0 votes
2 answers
125 views

What is the opposite of this data operation?

If I store in an array a double-value in this format, in which format I should be able to read the same double out? double myDouble = 12.123456; byte myArray[] = {0x00, 0x00, 0x00, 0x00}; myArray[0] ...
William Roy's user avatar
1 vote
4 answers
2k views

Digital Reading from a array without using the exact element

Is it possible to read a digital input from an array without using the exact element? Such as while(digitalRead(myButtonArray[i])) digitalWrite(myLEDArray[i], HIGH); Reading the ...
1fastk's user avatar
  • 15
0 votes
2 answers
7k 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 ...
mr-matt's user avatar
  • 147
5 votes
4 answers
4k 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 ...
panda_the_great's user avatar
-3 votes
1 answer
149 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 ...
user19167's user avatar