newbie needs help to download sketch

I am new.... I have downloaded the IDE software according to instructions I have pieced together my arduino UNO (R-3) with my Memsic 2025 accelerometer module. Now I have clicked on my IDE icon on my windows.. And up comes a box with these instructions ;

void setup() { // put your setup code here, to run once:

}

void loop() { // put your main code here, to run repeatedly:

I AM CLUELESS, I simply want to download the sketch for the Memsic 2025 so I can get a gravity read out. What do I do.

If I click on the "tools" and then click "serial Monitor" I get a two lines of readout in raw data (I assume) from the two axis....and it runs up the screen variably , responding to movement.

How do I download the sketch? Do I need to? ...can it be done without me trying to insert by hand all the lines of code given in the sketch...? I am clueless on how and what to print under "put your code here".... Thanks; Clueless

Found this with a google search: https://www.arduino.cc/en/Tutorial/Memsic2125

It's for a 2125 but might get you started.

Try cutting and pasting the code from the parallax site http://learn.parallax.com/kickstart/28017

Scroll down the page. Did you mean 2025 or 2125?

const int xIn = 2;              // X output
const int yIn = 3;              // Y output

void setup() {
  Serial.begin(9600);
}

void loop() {
  // variables to read the pulse widths:
  int pulseX, pulseY;

  pulseX = pulseIn(xIn,HIGH);  // Read X pulse  
  pulseY = pulseIn(yIn,HIGH);  // Read Y pulse

  // Display result
  Serial.print(pulseX);           // Display X and Y values
  Serial.print("\t");
  Serial.println(pulseY);

  delay(200);
}

G

Thanks Zardof; That is exactly what I have, a Parallax Memsic 2125... I will past exactly as you have listed...and try it... I will let you know >

@sterretje; in rrespose to your post I have gone thru that tutorial, and under the heading that says: "CODE", it says:"Open the Serial Monitor of the Arduino Software (IDE) to see the values read from the accelerometer position." I did that and got the raw data feed....After that statement it merely gives the Sketch....so I figure I must also upload the sketch..... But How? it doesn't say.

I'll get back after I try to copy and paste as Zardof suggested. Thanks...

OK; Zardof; I did the copy, (WITHOUT THE INSTRUCTIONS after //).....and after pressing "upload" I got an error message that says: "PulseX was not declared in this scope"

Any idea what that means?

Also...The lines of code in this sketch from Parallax that you gave are different from the lines of code from the site given by sterretje, given here: ---> https://www.arduino.cc/en/Tutorial/Memsic2125 Either one of you know what I am doing wrong?

OK; I got it working now....I accidently left out the first two lines of code.... Now I get a reading that is around 5000 for each axis... I guess that is the fraction of 2 g ???

Do you have: PulseX or pulseX

I used pulseX… I merely copy and pasted…it works with read out around approx. 5000 for the level position…
Thank you Zardof and sterretje…
However; this accelerometer has a range of 2 g so I assume these numbers give the fraction of 2 g when accelerating?
I’m sure I will have more questions when I get rolling.
At least I now know ( a little) about adding the code.

I read this has an accuracy of below 1/1000 th of a g.

My next question is, if anyone can help..... What do I add to my lines of code and where do I add it in order to get the "serial plotter" working so I can graph this output.??

The 2125 can read +/- 3g .

Have you got the correct pins connected? Does the values on the serial monitor change when you move the 2125?

What serial plotter?

G

Zardof: The 2125 can read +/- 3g .

Have you got the correct pins connected? Does the values on the serial monitor change when you move the 2125?

What serial plotter?

G

Hi Zardof; tanks for the help...yes; pins are correctly connected and after I click on the serial monitor, I am getting a good reading around 5000 when level... There is a "serial Plotter' I can click on in my IDA setup (in the "tools" drop-down box) which is next to the "serial monitor' which I click on after uploading the sketch. When I try to use the "serial plotter" I get nothing......apparently the code needs to include it for its use... I suppose.

...and yes;the serial monitor numbers change when I move the accel module.

Have a look at the following video Youtube video using serial plotter

You will have to make changes to your sketch to get this working. Follow the instructions given.

You could also have output the values to a logger shield. Then viewed the output in Excel.
You could also use ‘Processing’ software language. See video here:-Using MPU6050

Enjoy

G