Tagged Questions
5
votes
4answers
10k views
Arduino split String into String array
I have been playing around with programming for arduino but today i've come across a problem that i can't solve with my very limited C knowledge.
Here's how it goes.
I'm creating a pc application that ...
4
votes
2answers
135 views
In C++, how do I write a 3-dimensional array?
Thanks for looking!
Background
I am building a quadcopter and am placing on each of it's four arms a strip of RGB LEDs which are individually addressable. There are 6 LEDs per strip.
Further, ...
4
votes
1answer
110 views
Animating to an array
I have an Arduino, and I am trying to find the most efficient way to animate pixels in an array. The array is represented by 3 arrays of 30 uint8_ts. (30 pixels * R+G+B levels 0-255).
What is the ...
3
votes
4answers
236 views
Construct an int from binary “components” in C
I have several equations that will return the binary value for each of the three bits in my number.
I am programing this in C which is a new language for me.
So let's say my equations return Y0 = 1 ...
3
votes
4answers
3k views
C++ / Arduino: dynamic int array
I'm writing a class for the Arduino. It's been going well so far, but I'm sort of stuck now...
I have declared an int array in my class
class myClass
{
public: MyClass(int size);
private:
...
3
votes
4answers
516 views
How can I average a subset of an array and store the result in another array?
I have a C array fftArray[64] that contains values that I want averaged and placed into another array frequencyBar[8]. Getting the average of the entire array would be easy enough using a for ...
3
votes
3answers
414 views
How to define the length of a global array in a function on Arduino?
Is something like this possible in C++ (on Arduino)?
#include "stdio.h"
String str = "foo";
int i[strLength()]; // <- define length of array in function
int strLength() {
return str.length();
...
3
votes
4answers
2k views
Arduino PROGMEM byte array
Consider this snippet, compiled with Arduino IDE:
PROGMEM char charSet[] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xA , 0x6, 0xE, 0x1, 0x9,0x5, 0xD, 0x3,0xB,0x7,0xF };
char reversed[] = { 0x0, 0x8, ...
2
votes
4answers
571 views
Converting a byte array to an int array in C
I have some code below that is supposed to be converting a C (Arduino) 8-bit byte array to a 16-bit int array, but it only seems to partially work. I'm not sure what I'm doing wrong.
The byte array ...
2
votes
3answers
238 views
hide password from reading from .o file or .hex file
I'm writing a project on arduino and I'm storing a password in a const char array. This password is written in the code and I would like to hide the password from malicious readers who have access to ...
2
votes
1answer
334 views
Arduino Sketch - Object in header file not containing any values
I have the following in Codes.h, which I access by clicking on the tab within the Arduino Software. So I know the sketch is being loaded properly with the header file.
#ifndef __CODES_H__
#define ...
2
votes
3answers
748 views
Arduino - Iterate through C array efficiently
I have the following array:
PROGMEM prog_uint16_t show_hide_info[] = { 4216, 8900, 4380, 580, 500, 600, 500, 580, 1620, 580, 500, 600, 500, 580, 500, 600, 480, 600, 500, 580, 1620, 580, 1620, 600, ...
2
votes
1answer
378 views
How do I write an associative array in Arduino?
I would like to create an associative array. I believe I can benefit of the key/value type of array for simplicity reasons. For example, I could have key/values:
PH/2.85,
EC/700,
TEMP/72
I ...
2
votes
1answer
109 views
Working with arrays on Arduino in C++
I'm trying to manipulate arrays, but I'm a little confused with I need to do. I want to do something like:
char myArray[10];
myArray[0] = 0xA9;
myArray[1] = 'D';
myArray[2] = 'S';
myArray[3] = ...
2
votes
1answer
175 views
I have two ArrayLists in Processing, both of which I need to send to Arduino, and have the Arduino store them in its own arrays
I have the following sketch written in Processing, which scans an image, and stores the coordinates of each black pixel into two ArrayLists - xList, and yList. It currently then prints out the ...