redefinition of 'HMC5883L compass'
hello there!
i'm total newbie @ using arduino uno , i've got little problem. after connecting hmc5883l arduino , trying use compass.io github page error message. "installed" hmc5883l libary.
and complete error message:
report have more information with
"show verbose output during compilation"
enabled in file > preferences.
arduino: 1.0.6 (windows nt (unknown)), board: "arduino uno"
hmc5883l_simple:12: error: redefinition of 'hmc5883l compass'
sketch_jan23a:7: error: 'hmc5883l compass' declared here
hmc5883l_simple.ino: in function 'void setup()':
hmc5883l_simple:14: error: redefinition of 'void setup()'
sketch_jan23a:17: error: 'void setup()' defined here
hmc5883l_simple:20: error: 'class hmc5883l' has no member named 'begin'
hmc5883l_simple:27: error: 'class hmc5883l' has no member named 'setrange'
hmc5883l_simple:27: error: 'hmc5883l_range_1_3ga' not declared in scope
hmc5883l_simple:30: error: 'class hmc5883l' has no member named 'setmeasurementmode'
hmc5883l_simple:30: error: 'hmc5883l_continous' not declared in scope
hmc5883l_simple:33: error: 'class hmc5883l' has no member named 'setdatarate'
hmc5883l_simple:33: error: 'hmc5883l_datarate_30hz' not declared in scope
hmc5883l_simple:36: error: 'class hmc5883l' has no member named 'setsamples'
hmc5883l_simple:36: error: 'hmc5883l_samples_8' not declared in scope
hmc5883l_simple:39: error: 'class hmc5883l' has no member named 'setoffset'
hmc5883l_simple.ino: in function 'void loop()':
hmc5883l_simple:42: error: redefinition of 'void loop()'
sketch_jan23a:36: error: 'void loop()' defined here
hmc5883l_simple:44: error: 'vector' not declared in scope
hmc5883l_simple:44: error: expected `;' before 'norm'
hmc5883l_simple:47: error: 'norm' not declared in scope
do guys know whats problem?
i'm total newbie @ using arduino uno , i've got little problem. after connecting hmc5883l arduino , trying use compass.io github page error message. "installed" hmc5883l libary.
code: [select]
/*
hmc5883l triple axis digital compass. compass example.
read more: http://www.jarzebski.pl/arduino/czujniki-i-sensory/3-osiowy-magnetometr-hmc5883l.html
git: https://github.com/jarzebski/arduino-hmc5883l
web: http://www.jarzebski.pl
(c) 2014 korneliusz jarzebski
*/
#include <wire.h>
#include <hmc5883l.h>
hmc5883l compass;
void setup()
{
serial.begin(9600);
// initialize initialize hmc5883l
serial.println("initialize hmc5883l");
while (!compass.begin())
{
serial.println("could not find valid hmc5883l sensor, check wiring!");
delay(500);
}
// set measurement range
compass.setrange(hmc5883l_range_1_3ga);
// set measurement mode
compass.setmeasurementmode(hmc5883l_continous);
// set data rate
compass.setdatarate(hmc5883l_datarate_30hz);
// set number of samples averaged
compass.setsamples(hmc5883l_samples_8);
// set calibration offset. see hmc5883l_calibration.ino
compass.setoffset(0, 0);
}
void loop()
{
vector norm = compass.readnormalize();
// calculate heading
float heading = atan2(norm.yaxis, norm.xaxis);
// set declination angle on location , fix heading
// can find declination on: http://magnetic-declination.com/
// (+) positive or (-) negative
// bytom / poland declination angle 4'26e (positive)
// formula: (deg + (min / 60.0)) / (180 / m_pi);
float declinationangle = (4.0 + (26.0 / 60.0)) / (180 / m_pi);
heading += declinationangle;
// correct heading < 0deg , heading > 360deg
if (heading < 0)
{
heading += 2 * pi;
}
if (heading > 2 * pi)
{
heading -= 2 * pi;
}
// convert degrees
float headingdegrees = heading * 180/m_pi;
// output
serial.print(" heading = ");
serial.print(heading);
serial.print(" degress = ");
serial.print(headingdegrees);
serial.println();
delay(100);
}
and complete error message:
report have more information with
"show verbose output during compilation"
enabled in file > preferences.
arduino: 1.0.6 (windows nt (unknown)), board: "arduino uno"
hmc5883l_simple:12: error: redefinition of 'hmc5883l compass'
sketch_jan23a:7: error: 'hmc5883l compass' declared here
hmc5883l_simple.ino: in function 'void setup()':
hmc5883l_simple:14: error: redefinition of 'void setup()'
sketch_jan23a:17: error: 'void setup()' defined here
hmc5883l_simple:20: error: 'class hmc5883l' has no member named 'begin'
hmc5883l_simple:27: error: 'class hmc5883l' has no member named 'setrange'
hmc5883l_simple:27: error: 'hmc5883l_range_1_3ga' not declared in scope
hmc5883l_simple:30: error: 'class hmc5883l' has no member named 'setmeasurementmode'
hmc5883l_simple:30: error: 'hmc5883l_continous' not declared in scope
hmc5883l_simple:33: error: 'class hmc5883l' has no member named 'setdatarate'
hmc5883l_simple:33: error: 'hmc5883l_datarate_30hz' not declared in scope
hmc5883l_simple:36: error: 'class hmc5883l' has no member named 'setsamples'
hmc5883l_simple:36: error: 'hmc5883l_samples_8' not declared in scope
hmc5883l_simple:39: error: 'class hmc5883l' has no member named 'setoffset'
hmc5883l_simple.ino: in function 'void loop()':
hmc5883l_simple:42: error: redefinition of 'void loop()'
sketch_jan23a:36: error: 'void loop()' defined here
hmc5883l_simple:44: error: 'vector' not declared in scope
hmc5883l_simple:44: error: expected `;' before 'norm'
hmc5883l_simple:47: error: 'norm' not declared in scope
do guys know whats problem?
how many tabs have got in ide when compiling program ?
Arduino Forum > Using Arduino > Programming Questions > redefinition of 'HMC5883L compass'
arduino
Comments
Post a Comment