mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
+ minor fixes
This commit is contained in:
parent
fc7d6ff468
commit
7c0e98602e
@ -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);
|
||||
}
|
||||
|
@ -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: ");
|
||||
|
@ -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: ");
|
||||
|
@ -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: ");
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user