problems with i2c

87 views
Skip to first unread message

Fernando Palacios Escribano

unread,
Dec 3, 2013, 3:59:17 PM12/3/13
to quick2wi...@googlegroups.com
I have to send an array from an arduino to a raspberry pi but I have problems with the python code. Please, can you give an example to receive the array?
Thanks

Andrew Scheller

unread,
Dec 3, 2013, 8:33:45 PM12/3/13
to quick2wi...@googlegroups.com
> I have to send an array from an arduino to a raspberry pi but I have
> problems with the python code. Please, can you give an example to receive

There's no such thing as "sending an array". In a situation such as
this you'd typically send the length of the array first, and then
you'd just loop over the array sending each of the data values.
I've not done any i2c programming for ages, but in (very rough)
pseudo-code you could do something like:

my_array_length = read_number()
my_array = list()
while my_array_length > 0:
my_array.append(read_number())
my_array_length -= 1

Andrew
Reply all
Reply to author
Forward
0 new messages