So I’m trying to upload this program into my arduino to LSM303DLH
and this is the kind of error that I"m getting.
I tried everything and it still gives me this error.
"avrdude: stk500_getsync(): not in sync: resp = 0x00
"avrdude: stk500_disable(): protocol error, expect = 0x14, resp = 0x51
here is my code below
#include <Wire.h>
#include <LSM303DLH.h>
LSM303DLH compass;
void setup() {
Serial.begin(9600);
Wire.begin();
compass.enableDefault();
//North_Heading is whatever heading the unit reports when you point it North
#define NORTH_HEADING 10 //originally offset by 10 degrees (adjusted the code below to obtain 0 degrees as north)
// Calibration values. Use the Calibrate example program to get the value for
// your compass.
compass.m_min.x = -90; compass.m_min.y = -90; compass.m_min.z = 0;
compass.m_max.x = +90; compass.m_max.y = +90; compass.m_max = 359;
}
void loop() {
// reads the heading value of 0 to 359 from compass
// Returns the number of degrees from -Y axis that it
// is pointing
compass.read();
int heading = compass.heading((LSM303DLH::vector)(0 -1 0));
heading = ((heading - NORTH_HEADING) + 360) % 360;
//heading is now a number between 0 - 360 with 0 corresponding to North
Serial.println(heading);
delay(1000);
}