HT16K33 keyscan

Can anybody help with a program witch enables reading the keyscan memory in the HT16K33 using wire.h? I have been searching everyware without lock. I tried to use part of other programs without luck.

Wire.beginTransmission(0x70); // Initialize the Tx buffer
Wire.write(0x40); // Put slave register address in Tx buffer
Wire.endTransmission(false); // Send the Tx buffer, but send a restart to keep connection alive
Wire.requestFrom(0x70, 6); // Read bytes from slave register address
data = Wire.read(); // Fill Rx buffer with result
return data; // Return data read from slave register

thanks in advance Niels

Hi Neils.

Your code requests 6 bytes from the slave device, but then only reads one byte. It should read 6 bytes. These could be combined into an unsigned long long int and returned by a function.

Note that you cannot use bitRead() function on unsigned long long int, so you will need to read particular keys by creating a mask using bit shifting.

Hi PaulRB,

Seemingly, the code is running on Arduino Mega but not on the massdoino.. Perhaps, this is a compatibility issue with the wire library and the massdoino..

Best,
Niels