Go Down

Topic: I2C Arduino Uno Problem (Read 657 times) previous topic - next topic

Microneeds

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?

Code: [Select]


#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!!

grendle

not sure if needed/helpful but

Code: [Select]
Wire.endTransmission();

mistergreen

Here's an example
http://arduino.cc/en/Tutorial/SFRRangerReader

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

Microneeds

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?

grendle

Quote
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).  :D

mistergreen


Quote
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).  :D


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

grendle

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.

Go Up