Hi all,
I'm new to Arduino programming, but could not find any solution for my current problem on this forum.
Let me start by summing up what I have:
Arduino Mini USB Adapter
Arduino Mini328
ADXL345
I have connected the USB Adapter to the Arduino as follows:
USB Adapter Arduino
Tx Tx
Rx Rx
Ground Ground
+5V +5V
There is a LED connected from the Arduio's digital pin 13 to Ground for feedback.
No other power supply is used. The connections have been double-checked. This setup is connected to a Mac running OS X Lion.
To start, I used the Basic -> Blink program. The Arduino Mini does not have auto-reset (found that out the hard way..). So, before I upload a program, I reset the Arduino by pulling the Reset pin to Ground.
This is a snippet of the resulting log:
avrdude: Recv: . [10]
################################## | 100% 0.05s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude: Send: Q [51] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude done. Thank you.
It seems to start uploading, but at some point stops because the Device signature is bad. avrdude suggest to use the -F flag, and so I did.
Uploading on a terminal (copying the avrdude call from the log, and adding the -F flag) works. The blink program runs nicely.
But when adding some more code, the Arduino seemed to not function anymore. I've reduced the problem to this:
#include <Wire.h>
int testWire = 0; // If set to 1, the program will not reach the end of setup()
int m_Address = 0x1D; // ADX345's address
int statusPin = 13;
void setup() {
Wire.begin();
pinMode(statusPin, OUTPUT);
if (testWire) {
Wire.beginTransmission(m_Address);
Wire.endTransmission();
}
digitalWrite(statusPin, HIGH);
}
void loop() {}
The LED will only light up if testWire is set to 0. This means that when Wire.beginTransmission is called, the Arduino stops executing code.
What can be the cause of these two problems?
Thank you for your help!