Im trying to build my own boost gauge using a seven segment display, arduino uno, and a pressure sensor. the code I have so far is giving me an error can anyone help me out? I don't know what the problem is?
The problem is somehow with the calling of the function. However I don't know what changes to make?
ERROR
Boost_Final.cpp.o: In function loop': C:\Program Files (x86)\Arduino/Boost_Final.ino:179: undefined reference to writenum(int, int)'
collect2.exe: error: ld returned 1 exit status
Error compiling.
CODE
void setup() {
pinMode (2, OUTPUT);
pinMode (3, OUTPUT);
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
pinMode (6, OUTPUT);
pinMode (7, OUTPUT);
pinMode (8, OUTPUT);
pinMode (9, OUTPUT);
pinMode (10, OUTPUT);
pinMode (11, OUTPUT);
pinMode (12, OUTPUT);
pinMode (13, OUTPUT);
}
void loop() {
int digit;
int num;
void writenum(int digit, int num);
{
if (digit==1){
analogWrite(10, HIGH); // Chooses digit ? and lights up what are grounded
analogWrite(11, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(12, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(13, LOW); // Chooses digit ? and lights up what are grounded
}
else if (digit==2){
analogWrite(10, HIGH); // Chooses digit ? and lights up what are grounded
analogWrite(11, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(12, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(13, LOW); // Chooses digit ? and lights up what are grounded
}
else if (digit==3){
analogWrite(10, HIGH); // Chooses digit ? and lights up what are grounded
analogWrite(11, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(12, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(13, LOW); // Chooses digit ? and lights up what are grounded
}
else if (digit==4){
analogWrite(10, HIGH); // Chooses digit ? and lights up what are grounded
analogWrite(11, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(12, LOW); // Chooses digit ? and lights up what are grounded
analogWrite(13, LOW); // Chooses digit ? and lights up what are grounded
}
if (num==0){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, LOW); // Ground the segment c
analogWrite(5, LOW); // Ground the segment d
analogWrite(6, LOW); // Ground the segment e
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, HIGH); //
analogWrite(9, HIGH); //
}
else if (num==1){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, HIGH); //
analogWrite(5, HIGH); //
analogWrite(6, HIGH); //
analogWrite(7, HIGH); //
analogWrite(8, HIGH); //
analogWrite(9, HIGH); //
}
else if (num==2){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, HIGH); //
analogWrite(4, LOW); // Ground the segment c
analogWrite(5, LOW); // Ground the segment d
analogWrite(6, HIGH); //
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, LOW); // Ground the segment g
analogWrite(9, HIGH); //
}
else if (num==3){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, LOW); // Ground the segment c
analogWrite(5, HIGH); //
analogWrite(6, HIGH); //
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, LOW); // Ground the segment g
analogWrite(9, HIGH); //
}
else if (num==4){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, HIGH); //
analogWrite(5, HIGH); //
analogWrite(6, LOW); // Ground the segment e
analogWrite(7, HIGH); //
analogWrite(8, LOW); // Ground the segment g
analogWrite(9, HIGH); //
}
else if (num==5){
analogWrite(2, HIGH); //
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, LOW); // Ground the segment c
analogWrite(5, HIGH); //
analogWrite(6, LOW); // Ground the segment e
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, LOW); // Ground the segment g
analogWrite(9, HIGH); //
}
else if (num==6){
analogWrite(2, HIGH); //
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, LOW); // Ground the segment c
analogWrite(5, LOW); // Ground the segment d
analogWrite(6, LOW); // Ground the segment e
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, LOW); // Ground the segment g
analogWrite(9, LOW); // Ground the segment DP
}
else if (num==7){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, HIGH); //
analogWrite(5, HIGH); //
analogWrite(6, HIGH); //
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, HIGH); //
analogWrite(9, HIGH); //
}
else if (num==8){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, LOW); // Ground the segment c
analogWrite(5, LOW); // Ground the segment d
analogWrite(6, LOW); // Ground the segment e
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, LOW); // Ground the segment g
analogWrite(9, HIGH); //
}
else if (num==9){
analogWrite(2, LOW); // Ground the segment a
analogWrite(3, LOW); // Ground the segment b
analogWrite(4, LOW); // Ground the segment c
analogWrite(5, HIGH); //
analogWrite(6, LOW); // Ground the segment e
analogWrite(7, LOW); // Ground the segment f
analogWrite(8, LOW); // Ground the segment g
analogWrite(9, HIGH); //
}
else if (num==10){
analogWrite(2, HIGH); //
analogWrite(3, HIGH); //
analogWrite(4, HIGH); //
analogWrite(5, HIGH); //
analogWrite(6, HIGH); //
analogWrite(7, HIGH); //
analogWrite(8, HIGH); //
analogWrite(9, LOW); // Ground the segment DP
}
else if (num==11){
analogWrite(2, HIGH); //
analogWrite(3, HIGH); //
analogWrite(4, HIGH); //
analogWrite(5, HIGH); //
analogWrite(6, HIGH); //
analogWrite(7, HIGH); //
analogWrite(8, LOW); // Ground the segment for negative
analogWrite(9, HIGH); //
}
} //End Function List
int x = 3;
int y = 9;
writenum(x,y);
}