Where does the output data go when running accelerometer example program.

Arduino board, UNO. Example program for accelerometer uploads normal. AVRDUDE is OK. but no data on display and indication of data being saved at some memory location or file.

It might help if you shared the program with us.


// these constants describe the pins. They won't change: const int groundpin = 18; // analog input pin 4 -- ground const int powerpin = 19; // analog input pin 5 -- voltage const int xpin = A3; // x-axis of the accelerometer const int ypin = A2; // y-axis const int zpin = A1; // z-axis (only on 3-axis models)

void setup() { // initialize the serial communications: Serial.begin(9600);

// Provide ground and power by using the analog inputs as normal // digital pins. This makes it possible to directly connect the // breakout board to the Arduino. If you use the normal 5V and // GND pins on the Arduino, you can remove these lines. pinMode(groundpin, OUTPUT); pinMode(powerpin, OUTPUT); digitalWrite(groundpin, LOW); digitalWrite(powerpin, HIGH); }

void loop() { // print the sensor values: Serial.print(analogRead(xpin)); // print a tab between values: Serial.print("\t"); Serial.print(analogRead(ypin)); // print a tab between values: Serial.print("\t"); Serial.print(analogRead(zpin)); Serial.println(); // delay before next reading: delay(100); }

One thing I notice right off is that you have ground and power pins assigned to 18 and 19. These are not the analog input pins. It appears you need to do one of 2 things. Either (1) move your ground and power pin connections to two "A" pins (eg, A0), or (2) move them to arduino's designated v+ and gnd pins and delete the lines of code initializing these pins in your setup function. --Michael

edit: Is this breakout something like a shield that has to use certain pins? It seems odd using analog or digital outputs to supply power and ground to something.

You might want to add a "Serial.println("Hello, World!") to your setup to make sure that everything is working.

This program came directly from the Arduino software file for the “Example” for an accelerometer. The accelerometer draws so little power that it is part of the plan to use the analog pins as power and ground.
I have since check the activity on the USB port (com4) using hyperterminal and do see the data steaming out. So maybe everything is working normal, but I expected data within the program window.
Thanks for the comments.

Just arrived home where I could load your code and try it. It appears to run fine. While I don't have an accelerometer connected, it merrily prints a 3-column stream of numbers to my serial window. --Michael

If this works, you don't need the separate ground pin, just the +5 V one.

And first try it with the accelerometer hard wired to +5 and gnd.

Micheal, what are you referring to as your "serial window". I had to open hyperterminal to see the data stream on the serial port. I expected the data to come back in the Arduino window somewhere. I want to save the data to a file (for EXCEL) and plot it in EXCEL.

Ah. If you're using the arduino IDE, look for the magnifying glass icon at the top right. Clicking on that opens a serial monitor window and restarts the sketch. Note that at the bottom of the serial monitor window, there is a drop-down menu for setting the baud rate. Make sure it matches the baud rate in your sketch. --Michael

OH! That is exactly what I was looking for.Thank you very much.

Well, I'm still on the lower slope of the learning curve, but I'm happy to offer whatever help I can. --Michael