#include <avr/pgmspace.h>
// char x00[] = {
// "01011010"
// "11111110"
// "10111110"
// "11101111"
// "0101101011111110101111101110111101011010111111101011111011101111"
// "*" // end of array
// };
const char PROGMEM x00[] = {
" ############## ############## ### "
" ###################### ###################### # R #"
" ########################## ########################## ### "
" ############################## ############################## "
" ########### ########### ########### ########### "
" ######### ################## ######### "
"######## ############## ######### "
"######## ############ ###### ########"
"####### ########## ###### #######"
"####### ############## ######## ############## #######"
"####### ############## ###### ############## #######"
"####### ############## ######## ############## #######"
"####### ########## ###### #######"
"######## ############ ###### ########"
"######## ############## ######## "
" ######### ################## ######### "
" ########### ########### ########### ########### "
" ############################## ############################## "
" ########################## ########################## "
" ###################### ###################### "
" ############## ############## "
" "
" ### ######## ######## ### ### ######### ### ### ####### "
" ##### ######### ######### ### ### ######### #### ### ######### "
" ### ### ### ### ### ### ### ### ### ##### ### ### ### "
" #### #### ### ### ### ### ### ### ### ######### ### ### "
" ######### ######### ### ### ### ### ### ######### ### ### "
" ######### ######## ### ### ### ### ### ### ##### ### ### "
" ### ### ### ### ######### ######### ######### ### #### ######### "
" ### ### ### ### ######## ####### ######### ### ### ####### "
"*" // end of array
};
void setup() {
Serial.begin(115200);
delay(1000);
Serial.print("const char array[] PROGMEM = {"); // beginning of array
}
int total, j;
void loop() {
encode(); // ascii to hex
// decode(); // hex to ascii
}
void encode() {
for (int i = 0; i < 8; i++) {
byte thebit = pgm_read_byte[j * 8 + (7 - i)] - '0';
// byte thebit = x00[j * 8 + (7 - i)] - '0';
total += thebit << i;
}
Serial.print("0x");
if (total < 0x10)
Serial.print("0");
Serial.print(total, HEX);
total = 0; // reset byte total
j++; // number of bytes
if (pgm_read_byte[j * 8] == '*') {
// if (x00[j * 8] == '*') {
done();
} else {
Serial.print(", ");
}
}
void done() {
Serial.println("};");
while (1) {};
return;
}