I need to print 4-bit long numbers, these numbers are Binary numbers frome 0 to 16 (0000, 0001, 0010, ...).
PROBLEMS:
Considering this code:
char array[] = {'0000', '0001', '0010', '0011'};
int i;
void setup() {
Serial.begin(9600);
}
void loop() {
while (i < 4){
Serial.println(array[i]);
i++;
}
}
The serial monitor outputs:
0
1
0
1
My expected output is:
0000
0001
0010
0011
It seems that only the first "character" of each element of the array is read.
QUESTION: How can I print the entirety of each element like in my expected output?
After some reasearch, I found this:
which then refers to using PROGMEM but I'm not sure if this is what I need or if there is a simpler solution to my problem.
'0000'are implementation-defined in how they work. Please don't use such. If you want multiple characters, use strings instead.charis a single byte. How would you fit four characters into a single byte?sketch_nov11b.ino:1:17: warning: character constant too long for its type char array[] = {'0000', '0001', '0010', '0011'};?