I am using a Arduino Nano Rev 3.1 with Arduino.exe 1.0.4 with a I2C LED control chip
I need to send the chip address, a LED address and 2 bytes of data. I found the Wire.h library and a bunch of web pages and tutorials but I can’t make it work. I am beginning to wonder if the Nano I am using is damaged.
The reference for Wire.h indicate there will be pull ups on the clock and data, but I did not have them and added resistors.
The reference for Wire.h indicates it will append a 1 as the most significant address bit on the address, my first address bit is always a zero even if I set the address to 0x80.
My sketch sends the address and 3 data bytes. All I see on the scope is an address byte without the MSB set, my control byte, the first byte of data, then end of message.
I am looking for any advice, is it software, is it a damaged Nano.
/******************************************************
Arduino Nano I2C test
5/4/2013
*******************************************************/
// Arduino Nano A4 is I2C SDA
// Arduino Nano A5 is I2C SCL
//Nano is a rev 3.1 Arduino.exe is 1.0.4
#include "Wire.h"
void setup() // run once, when the sketch starts
{
Wire.begin(); //start wire library for I2C
delay(20);
}
void loop(void)
{
int i=0, j=0, k=0;
digitalWrite(2, LOW); // chip enable
while(1)
{
SendLED();
delay(5);
}
}
void SendLED(void)
{
- Wire.beginTransmission(0); //chip address
- Wire.write(3); //send LED address
- Wire.write(15); //send low data byte
- Wire.write(63); //send hi data byte
- Wire.endTransmission(); //end command
}