+ minor fixes

This commit is contained in:
Rob Tillaart 2013-09-30 17:09:58 +02:00
parent fc7d6ff468
commit 7c0e98602e
6 changed files with 14 additions and 8 deletions

View File

@ -25,7 +25,7 @@ void setup()
Serial.print("current output modus");
Serial.println(Compass.getOutputModus());
x = Compass.askHeading();
int x = Compass.askHeading();
//Serial.print("Ask returns: ");
//Serial.println(x);
}

View File

@ -57,7 +57,6 @@ void loop()
delay(10);
Wire.requestFrom(HMC, 1);
i = 0;
while(Wire.available() < 1);
value = Wire.receive();
Serial.print("Current Mode: ");

View File

@ -58,7 +58,6 @@ void loop()
delay(10);
Wire.requestFrom(HMC, 1);
i = 0;
while(Wire.available() < 1);
value = Wire.receive();
Serial.print("Current Mode: ");

View File

@ -58,7 +58,6 @@ void loop()
delay(10);
Wire.requestFrom(HMC, 1);
i = 0;
while(Wire.available() < 1);
value = Wire.receive();
Serial.print("Current Mode: ");

View File

@ -29,22 +29,31 @@ int x;
void loop()
{
Compass.wakeup(); // decent wake up from sleep mode
Compass.wakeUp(); // decent wake up from sleep mode
// Note that reading a heading is requires two steps, ask() & read()
// this makes the query and continuous mode more efficient
// without impact on the footprint of the lib.
// a wrapper is an option.
// this way one can ask a make a reading and fetch it a bit later.
// TODO is it fast enough for IRQ ?
x = Compass.askHeading();
//Serial.print("Ask returns: ");
//Serial.println(x);
x = Compass.readHeading();
Serial.print("Degree : ");
Serial.print("ask & read : Degree : ");
Serial.println(x);
Compass.sleep(); // low energy mode
delay(500);
// this is the simplest mode to use the library
// suitable for 99.9% of all robots :)
Compass.wakeUp();
Serial.print("getHeading : Degree : ");
Serial.println(Compass.getHeading());
Compass.sleep();
delay(500);
}
// END OF FILE

View File

@ -14,7 +14,7 @@
#include "Wprogram.h"
#define HMC_LIB_VERSION "0.1.01"
#define HMC_LIB_VERSION "0.1.03"
#define HMC_GET_DATA 0x41
#define HMC_WAKE 0x57