Hello all you wonderful Arduino'ers!
Once again I dusted off my Arduino to tinker on a new ever evolving project and whilst I have had some challenges in getting the project to where oit is now .. I am quite happy I have it working...
I am undersure how I might pass some data and work on the variables iwth varying types ..
At the moment, I define some ASCII characters in binary "bitmaps"
const uint8_t PROGMEM char_M[8] = { // store in program memory to save RAM
B11111111, B11111110, B00001100, B00111000, B00111000, B00001100, B11111110, B11111111};
I then call a function to use this data and write it to some an LED strip:
void chrM() {
for (byte x = 0; x < 8; ++x) {
int i = 0;
byte data = pgm_read_byte (&char_M[x]); // fetch data from program memory
for (byte y = 0; y < 8; ++y) {
if (data & (1 << y)) {
writeColour(i);
i++;
} else {
colors[i] = (rgb_color) {
0, 0, 0
};
i++;
}
// repeat for 8 bits
}
writeDisplay();
}
}
But here in lies the problem .. I have over 70 functions with just the variable changing meaning my program is becoming bloatware
Could someone show or guide me to how I might do bitwise operations on the passed variable .. It's the & which is confusing me!
Essentially, I would like to use one function and change the &char_M[x] variable.
Thanks in advance