but when I try to hit the "serial monitor" button to try to get the output that they are getting
from that website, I'm not getting anything on the terminal window.
Only have a serial statement in setup that says "Setup" and one in loop that says "loop". If that isn't returning anything, you have a more fundamental issue.
This code is what I used to try to have the terminal window show bunch of results from 0 to 359
#include <LSM303DLH.h>
#include <Wire.h>
LSM303DLH compass;
void setup() {
Serial.begin(9600);
Wire.begin();
compass.enableDefault();
}
//void LSM303DLH::calibrate(void)
void loop() {
compass.calibrate();
compass.read();
int respond = 0;
Serial.println("Hit any key when ready to calibrate.");
//wait till R is pressed
while ( respond == 0)
{
while (Serial.available()==0);;
while (Serial.available()>0)
{
respond = Serial.read();
}
}
Serial.println("Rotate board until Min and Max values are reched for all axis.");
Serial.println("WHen calibration done press D...");
delay(3000);
while (respond != 100)
{
while (Serial.available()==0)
{
//Loop till D is pressed
compass.read();
if (compass.m.x > compass.m_max.x)
{
compass.m_max.x = compass.m.x;
}
if (compass.m.y > compass.m_max.y)
{
compass.m_max.y = compass.m.y;
}
if (compass.m.z > compass.m_max.z)
{
compass.m_max.z = compass.m.z;
}
if (compass.m.x < compass.m_min.x)
{
compass.m_min.x = compass.m.x;
}
if (compass.m.y < compass.m_min.y)
{
compass.m_min.y = compass.m.y;
}
if (compass.m.z < compass.m_min.z)
{
compass.m_min.z = compass.m.z;
}
//Display results
/////////////
if (compass.a.x > compass.a_max.x)
{
compass.a_max.x = compass.a.x;
}
if (compass.a.y > compass.a_max.y)
{
compass.a_max.y = compass.a.y;
}
if (compass.a.z > compass.a_max.z)
{
compass.a_max.z = compass.a.z;
}
if (compass.a.x < compass.a_min.x)
{
compass.a_min.x = compass.a.x;
}
if (compass.a.y < compass.a_min.y)
{
compass.a_min.y = compass.a.y;
}
if (compass.a.z < compass.a_min.z)
{
compass.a_min.z = compass.a.z;
}
////////
Serial.print("Maxx: ");
Serial.print(compass.m_max.x);
Serial.print(" MaxY: ");
Serial.print(compass.m_max.y);
Serial.print(" MaxZ: ");
Serial.print(compass.m_max.z);
Serial.print("Minx: ");
Serial.print(compass.m_min.x);
Serial.print(" MinY: ");
Serial.print(compass.m_min.y);
Serial.print(" MinZ:: ");
Serial.println(compass.m_min.z);
///////
Serial.print("Maxx: ");
Serial.print(compass.a_max.x);
Serial.print(" MaxY: ");
Serial.print(compass.a_max.y);
Serial.print(" MaxZ: ");
Serial.print(compass.a_max.z);
Serial.print("Minx: ");
Serial.print(compass.a_min.x);
Serial.print(" MinY: ");
Serial.print(compass.a_min.y);
Serial.print(" MinZ:: ");
Serial.println(compass.a_min.z);
////////
}
while (Serial.available()>0)
{
respond = Serial.read();
}
}
//D pressed -> end loop
Serial.println("DONE");
delay(2000);
}
so far my terminal window shows nothing... am I doing something wrong?
I'm using the Arduino Uno to connect to LSM303DLH breakout (from sparkfun) and also the logic level converter. I hooked up everything accordingly and I have no error in the code as well but nothing is showing up in my terminal session window.