Here's my code, when i try to compile it, it returns an error (there is no line highlighted indicating where the error is) :
My code:
/*
multiplexer sketch
read 1 of 8 analog values into single analog input pin with 4051 multiplexer
array of pins used to select 1 of 8 inputs on multiplexer
*/
boolean digitalReadMux(int channel);
int LedPin = 13;
const int select[] = {8,9,10}; // array of the pins connected to the 4051 input select lines
const int analogPin = A1; // the analog pin connected to the multiplexer output
// this function returns the analog value for the given channel
int getValue( int channel)
{
// the following sets the selector pins HIGH and LOW to match the binary value of channel
for(int bit = 0; bit < 3; bit++)
{
int pin = select[bit]; // the pin wired to the multiplexer select bit
int isBitSet = bitRead(channel, bit); // true if given bit set in channel
digitalWrite(pin, isBitSet);
}
return analogRead(analogPin);
}
void setup()
{
for(int bit = 0; bit < 3; bit++)
pinMode(select[bit], OUTPUT); // set the three select pins to output
pinMode (13, OUTPUT);
}
void loop () {
if (digitalReadMux(0) == 1) {
digitalWrite(LedPin, HIGH);
}
if (digitalReadMux(1) == 1) {
digitalWrite(LedPin, LOW);
}
}
The error :
Multiplexer2LEDs.cpp.o: In function `loop':
AppData\Local\Temp\build560401855751289364.tmp/Multiplexer2LEDs.cpp:35: undefined reference to `digitalReadMux(int)'
AppData\Local\Temp\build560401855751289364.tmp/Multiplexer2LEDs.cpp:38: undefined reference to `digitalReadMux(int)'