MiraBox User Guide
–page
26
/
29
/*********** control the GPIO OP-2 **************************************/
//turn on LED
(e2prom_data.msgs[0]).buf[0]=0x1a;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0x0;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error3");
}
//turn off LED
sleep(1); //delay 1 second
(e2prom_data.msgs[0]).buf[0]=0x1a;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0xFF;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error3");
}
/*********** control the GPIO OP-3 **************************************/
//turn on LED
sleep(1);
(e2prom_data.msgs[0]).buf[0]=0x1b;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0x0;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error4");
}
//turn off LED
sleep(1);
(e2prom_data.msgs[0]).buf[0]=0x1b;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0xFF;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error4");
}