Pages: [1]   Go Down
Author Topic: I2C Arduino Uno Problem  (Read 625 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

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

Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

not sure if needed/helpful but

Code:
Wire.endTransmission();
Logged

0
Offline Offline
Sr. Member
****
Karma: 8
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).  smiley-grin
Logged

0
Offline Offline
Sr. Member
****
Karma: 8
Posts: 291
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).  smiley-grin

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

Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: