Hello.
I’ve been trying to hash letters to binary sequences in accordance with the International Telegraph Alphabet. I wrote the codes down using the hashmap.h library. However, when I open up the serial monitor I only see the binary values in integer format. For example:
Instead of seeing C = 01110, I see the value C=14.
I want to keep it in the binary format, how can I do it? I also tried writing them down as B00100, B11000 etc. but didn’t work. Here is the code:
#include <HashMap.h>
const byte HASH_SIZE = 27;
HashType<char,byte> hashRawArray[HASH_SIZE];
HashMap<char, byte> hashMap = HashMap<char,byte>( hashRawArray , HASH_SIZE );
void setup(){
//setup hashmap
hashMap[0]('A',11000);
hashMap[1]('B',10011);
hashMap[2]('C',01110);
hashMap[3]('D',10010);
hashMap[4]('E',10000);
hashMap[5]('F',10110);
hashMap[6]('G',01011);
hashMap[7]('H',00101);
hashMap[8]('I',01100);
hashMap[9]('J',11010);
hashMap[10]('K',11110);
hashMap[11]('L',01001);
hashMap[12]('M',00111);
hashMap[13]('N',00110);
hashMap[14]('O',00011);
hashMap[15]('P',01101);
hashMap[16]('Q',11101);
hashMap[17]('R',01010);
hashMap[18]('S',10100);
hashMap[19]('T',00001);
hashMap[20]('U',11100);
hashMap[21]('V',01111);
hashMap[22]('W',11001);
hashMap[23]('X',10111);
hashMap[24]('Y',10101);
hashMap[25]('Z',10001);
hashMap[26](' ',00100);
Serial.begin(9600);
//Serial.println( hashMap.getIndexOf("T"),DEC );
Serial.println(hashMap.getValueOf('C'), BIN );
hashMap.debug();
}
void loop(){/*nothing to loop*/}
Thanks!