pls help me quick in this programming question..

/*
#include
#include

HMC5883L compass;
*/

void setup() { Serial.begin(9600);
//LED pins pinMode (12, OUTPUT); pinMode (11, OUTPUT); pinMode (10, OUTPUT); pinMode (8, OUTPUT); pinMode (7, OUTPUT); pinMode (5, OUTPUT);

// sound pin pinMode (6, OUTPUT);

// Initialize HMC5883L Serial.println(“Initialize HMC5883L”); while (!compass.begin()) { Serial.println(“Could not find a 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_15HZ);

// Set number of samples averaged compass.setSamples(HMC5883L_SAMPLES_8);

// starting intro

digitalWrite (5, HIGH); delay(50); digitalWrite (5, LOW); digitalWrite (7, HIGH); delay(50); digitalWrite (7, LOW); digitalWrite (8, HIGH); delay(50); digitalWrite (8, LOW); digitalWrite (10, HIGH); delay(50); digitalWrite (10, LOW); digitalWrite (11, HIGH); delay(50); digitalWrite (11, LOW); digitalWrite (12, HIGH); delay(50); digitalWrite (12, LOW); digitalWrite (11, HIGH); delay(50); digitalWrite (11, LOW); digitalWrite (10, HIGH); delay(50); digitalWrite (10, LOW); digitalWrite (8, HIGH); delay(50); digitalWrite (8, LOW); digitalWrite (7, HIGH); delay(50); digitalWrite (7, LOW); digitalWrite (5, HIGH); delay(50); digitalWrite (5, LOW);

analogWrite(6, 10); delay(50); analogWrite(6, 50); delay(50); analogWrite(6, 150); delay(50); analogWrite(6, 0);

}

int Xaxis; int Yaxis; int Zaxis; int sumAxis; int lastSumAxis;

void loop() { Vector raw = compass.readRaw(); Vector norm = compass.readNormalize();

Xaxis = norm.XAxis; Yaxis = norm.YAxis; Zaxis = norm.ZAxis;

Xaxis = (Xaxis / 1) * 1; Yaxis = (Yaxis / 1) * 1; Zaxis = (Zaxis / 1) * 1;

sumAxis = Xaxis + Yaxis + Zaxis;

if (lastSumAxis > sumAxis + 5 || lastSumAxis < sumAxis - 5) // when the Hall sensor detects a magnetic field, Arduino LED lights up { digitalWrite (5, HIGH); analogWrite(6, 110); } else { digitalWrite (5, LOW); analogWrite(6, 0); }

if (lastSumAxis > sumAxis + 10 || lastSumAxis < sumAxis - 10) // when the Hall sensor detects a magnetic field, Arduino LED lights up { digitalWrite (7, HIGH); } else { digitalWrite (7, LOW); }

if (lastSumAxis > sumAxis + 20 || lastSumAxis < sumAxis - 20) // when the Hall sensor detects a magnetic field, Arduino LED lights up { digitalWrite (8, HIGH); } else { digitalWrite (8, LOW); }

if (lastSumAxis > sumAxis + 40 || lastSumAxis < sumAxis - 40) // when the Hall sensor detects a magnetic field, Arduino LED lights up { digitalWrite (10, HIGH); } else { digitalWrite (10, LOW); }

if (lastSumAxis > sumAxis + 80 || lastSumAxis < sumAxis - 80) // when the Hall sensor detects a magnetic field, Arduino LED lights up { digitalWrite (11, HIGH); } else { digitalWrite (11, LOW); }

if (lastSumAxis > sumAxis + 160 || lastSumAxis < sumAxis - 160) // when the Hall sensor detects a magnetic field, Arduino LED lights up { digitalWrite (12, HIGH); } else { digitalWrite (12, LOW); }

Serial.print(" Sum Axis = "); Serial.print(sumAxis); Serial.println(); lastSumAxis = sumAxis;

delay(20); }

this is my code and it says that ‘Vector’ was not declared in this scope
so i dont know how to fix it .
pls help its urgent and also tell if u can find any other errors

Why is there that comment at the top of your badly -posted code?

Where did you copy the code from?
Can they help you?

(BTW this project is only urgent to you, unless it somehow averts or reverses the planet’s climate emergency.)

this is where i got the code
i am quite new to this so help pls me..

dont be rude i am just asking for help :slight_smile:

Instructables continues to live up to its reputation.

How did they respond to your request for help?

(Did you notice that your code doesn’t look like the incomplete code in the Instructable?)

wait.. is the instructables one incomplete
could u tell me what to correcct

Well there’s the two empty "#include"s for a start.

so um what shld i put in there

do have an insta account or hangouts coz i might need ur help a BIT more.

Well, one of them probably says something like “#include <HMC5883L.h>”

Not sure about the other.

Sorry, I don’t speak txt.

gautham_dhan1sh:
wait.. is the instructables one incomplete

Generally speaking, any code you find on instructables will be crap. A good rule of thumb is that you get what you pay for. In this case, you didn't even get that much.

TheMemberFormerlyKnownAsAWOL:
Well, one of them probably says something like "#include <HMC5883L.h>"

Not sure about the other.

Although, there is a big, fat clue on the instructables page that @gautham_dhan1sh seems to have overlooked:

gfvalvo:
Generally speaking, any code you find on instructables will be crap. A good rule of thumb is that you get what you pay for. In this case, you didn’t even get that much.

I just exhaled a perfectly good noseful of Doom Bar bitter.