Hello
I have a Hobbytronics keyboard USB host IC connected to my UNO.
All I am getting is '10' printed on the screen every 5 seconds. I have checked the I2C bus with a scanner and it pings back 0x29 (41), so that should be correct.
If you mash an attached keyboard (the led on the 28 pin IC illuminates to show correct connection of the keyboard), you get a random number returned. Never the correct one or the letter you pressed.
This is the demo code from their webpage. I have emailed their tech help, but no response yet.
Any ideas?
/*
** Wire Master Reader of Hobbytronics USB Host Keyboard
** Created 24 Oct 2013
**
** This example code is in the public domain.
** www.hobbytronics.co.uk
*/
#include <Wire.h>
const int adc_address=41; // I2C Address
char keyboard_data[80]; // Array to store keyboard values
void setup()
{
//Send settings to ADC_I2C device (optional)
Wire.begin(); // join i2c bus (address optional for master)
//Start Serial port
Serial.begin(9600); // start serial for output
}
void loop()
{
unsigned char i;
char keyboard_chars;
Wire.beginTransmission(adc_address); // transmit to device
Wire.write(1); // ask how many characters are in buffer
Wire.endTransmission(); // stop transmitting
Wire.requestFrom(adc_address, 1); // request 1 bytes from slave device
while(Wire.available())
{
keyboard_chars = Wire.read();
}
Serial.println(keyboard_chars, DEC); // print number of buffer characters
Wire.beginTransmission(adc_address); // transmit to device
Wire.write(0); // get keyboard characters
Wire.endTransmission(); // stop transmitting
Wire.requestFrom(adc_address, keyboard_chars); // request characters from slave device
i=0;
while(Wire.available())
{
keyboard_data[i++] = Wire.read();
keyboard_data[i] = '\0';
}
Serial.println(keyboard_data); // print the character
keyboard_data[0]='\0';
delay(5000); // Wait 5 seconds
}