Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

[size=16][highlight][color=#ff0000][b]This forum is now [u]READ-ONLY[/u]! Please visit [url]http://forum.wiring.co/[/url] for the new forum.[/b][/color][/highlight][/size]

Wiring ForumProgramming Questions & HelpPrograms › Basic issue using Wire library with Arduino

Page Index Toggle Pages: 1
Basic issue using Wire library with Arduino (Read 12857 times)
05/05/07 at 21:02:07

gnagent   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 2
*
 
Hello,

I'm new to the ATmega168, Arduino, and the Wire library. I'm trying to start as simply as I can, but I have to admit, I'm already having problems.

My environment is an Arduino NG rev. C (ATmega168) with the Arduino IDE v.0007 running on a Mac. (I've also run this on a PC.) I have not modified any Wire files provided in the v0007 IDE.

My goal is to use TWI/I2C to interface to a thermometer (DS1621).

I'm starting with a very basic sketch:

#include <Wire.h>

int ct = 0;

void setup() {
  //Wire.begin(); // join i2c bus as Master
  Serial.begin(9600);
  Serial.println("Init complete");
}

void loop() {
  Serial.print(ct);
  Serial.println(" in loop()");
  delay(1000);
  ct++;
}

This sketch returns the following output:

Init complete
0 in loop()
1 in loop()
2 in loop()
3 in loop()
4 in loop()
5 in loop()

and so on.

If I uncomment the line that initializes Wire, I get no output. I never see "Init complete" nor any output from loop().

void setup() {
  Wire.begin(); // join i2c bus as Master
  Serial.begin(9600);
  Serial.println("Init complete");
}

(No output from running this.)

Can anyone tell me what I am missing? I've run this with nothing attached to the Arduino board. I've run it with the entire DS1621 circuit attached to the board. It doesn't change the behavior.

Given that www.arduino.cc links directly to the Wire library, I have a hard time believing that the library doesn't work with a rev C board. But at this point, I can't think of anything else to test.

Thanks for any suggestions any of you can give me!

-- Dan
 
IP Logged
 
Reply #1 - 05/05/07 at 21:49:20

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
hi, I am afraid I can only help with the syntax, and yours seems right, so if there is an error it must be related to the arduino implementation itself, you can try to check in their forum for any Wire library specific issue with their board.
 
IP Logged
 
Reply #2 - 05/07/07 at 00:57:34

gnagent   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 2
*
 
Thanks for the response. I've posted on the Arduino forum. We'll see if anyone responds. I've seen code examples that are nearly what I have, but no idea what rev of the board they are using. I feel like it has to be something like that. Anyway, thanks again!
 
IP Logged
 
Page Index Toggle Pages: 1