I2C Arduino Uno Problem

HI all,

I am new to arduino and I2C and I have a problem, since when I am using the I2C programming with the WIRE functions and also using 4.7Kohms pull up resistors, When just connecting an oscilloscope to the pin A5 I still cant see any clock but only a high on that pin. Can someone tell me why please?

#include <Wire.h>

void setup()
    {              
         Wire.begin();  
         Serial.begin(9600); 
    }

void loop() {
  
  Wire.beginTransmission(0x2F);      // part address is 0x2F or 0101111b
  
  Wire.write(69); // sends 69 down the bus


}

Thanks alot!!

not sure if needed/helpful but

Wire.endTransmission();

Here's an example

you usually send 0x00 first to the device to tell it to get ready.
And you'll need Wire.endTransmission() at the end.

First of all thanks for the fast reply! does it make any difference since I don't have any slave connected? since I am currently experimenting with the arduino.

Also I used to programm PICs, and I also used to see the Acknowledge from the slaves, are the ACK seen with the WIRE function?

you usually send 0x00 first to the device to tell it to get ready.

not all devices needs this, best to check the datasheet for your specific device(s). :smiley:

grendle:

you usually send 0x00 first to the device to tell it to get ready.

not all devices needs this, best to check the datasheet for your specific device(s). :smiley:

yup. I have a sensor where I need to send 4 bytes first, not just 0x00. It depends.

Wire.endTransmission(); should return a zero on success.

some very good information is here http://www.gammon.com.au/forum/?id=10896, should get you going and answer all your questions. it helped me alot.