programming help!!

Hello,
I have an l3g4200d accelerometer, i set it up so i can measure an angle in degrees.
unfortunately it doesnt stop to 359 degrees and then to 0,it continius to rise!
same think when it goes to the other direction.

is any code to make it go up to 359 and then to 0?

Try this:

void setup() {
  int degrees;
  int i;

  Serial.begin(9600);

  for (i = 0; i < 750; i++) {
    degrees = i % 360;
    Serial.print("  ");
    if (i % 10 == 0) {
      Serial.println(degrees);
    } else {
      Serial.print(degrees);
    }
  }
}

void loop() {

}

thanks you sir!! :slight_smile: