Hi all, There is someone who tried to interface arduino to RIOT (the board in my case is SAMR21-xpro) through the I2C ?
I would config the Arduino as MASTER (i’ve already did it with wire.h) and samr21 as SLAVE.
I did a code like this :
int main(void)
{
puts(“I2C Reader”);
/* define own shell commands */
//char line_buf[SHELL_DEFAULT_BUFSIZE];
//shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
char data;
int read=0;
while(1){
puts(“waiting for data…”);
i2c_poweron(0);
do{
read = i2c_read_byte(0, 8, data);
if(read==-1)
{
puts(“ERROR : UNDEFINED DEVICE”);
break;
}else if(read>0)
printf(“data arrived : %c”,data);
}while(read<1);
}
return 0;
}
Arduino will send 5 byte at time, but the samr21 doesn’t receive nothing…any ideas?
Thanks all !