I cant find the solution to get this running.
I just want to convert x Seconds to byte and send it via i2c
This is what i tried so far:
off_timer_byte = format(5, '#04x'); #convert decimal to i2c bytes
# also tried this
off_timer_byte = hex(5); #convert decimal to i2c bytes
bus.write_i2c_block_data(address, 0x00, [0x10, off_timer_byte])
The variable "off_timer_byte" can range von 0 to 256. These are seconds to shut down a i2c device after x seconds.
I get this Error:
pi@raspberrypi ~ $ sudo python off.py
Traceback (most recent call last):
File "off.py", line 48, in <module>
bus.write_i2c_block_data(address, 0x00, [0x10, off_timer_byte])
TypeError: Third argument must be a list of at least one, but not more than 32 integers
but
bus.write_i2c_block_data(address, 0x00, [0x10, 0x2])
or
bus.write_i2c_block_data(address, 0x00, [0x10, 0x19])
works fine.
Where is the problem?
Thanks so far! ;-)