I'm am trying to interface my PIC16F886 with a Blinkm, but I cannot seem to communicate to the Blinkm, because it remains always in its demo mode.
I've tried to demonstrate communication by setting a color with this code:
void main () {
Soft_I2C_Config(&PORTC, 4, 3);
Soft_I2C_Start();
Soft_I2C_Write(0x09); // Address BlinkM
Soft_I2C_Write(0x6e);
Soft_I2C_Write(0);
Soft_I2C_Write(0);
Soft_I2C_Write(150);
Soft_I2C_Stop();
}
I've also tried the hard I2C Library. Nothing seems to work. If anyone has example code or advice, it would be greatly appreciated. For those wondering, I am pretty sure the hardware connections are made correctly (with pull up resistors on the clock and data pins).
Thanks
Trouble using Blinkm
-
- Posts: 2780
- Joined: 25 Dec 2008 15:22
- Location: Scotland
Re: Trouble using Blinkm
just because you send start and address, may not actually mean the device has ACKnowledged the commands.bentutt wrote:I'm am trying to interface my PIC16F886 with a Blinkm, but I cannot seem to communicate to the Blinkm, because it remains always in its demo mode.
I've tried to demonstrate communication by setting a color with this code:
void main () {
Soft_I2C_Config(&PORTC, 4, 3);
Soft_I2C_Start();
Soft_I2C_Write(0x09); // Address BlinkM
Soft_I2C_Write(0x6e);
Soft_I2C_Write(0);
Soft_I2C_Write(0);
Soft_I2C_Write(150);
Soft_I2C_Stop();
}
I've also tried the hard I2C Library. Nothing seems to work. If anyone has example code or advice, it would be greatly appreciated. For those wondering, I am pretty sure the hardware connections are made correctly (with pull up resistors on the clock and data pins).
Thanks
if you dont have a scope to probe the bus, i would start by trying to read something from the blinkm, like its address or firmware version number. if you only have 1 device on the bus you can use the 0x00 address method. I would also start with hardware I2C rather than soft_i2c. you could also try sending the command to stop the script running.
when you cant get something to work always try something lesser to start with. Like read the device before trying to write to it.
-
- Posts: 2780
- Joined: 25 Dec 2008 15:22
- Location: Scotland