Multiplexer Analog read code not compiling

I have the following code that MikMo published for sending 16 analog input signals to out to serial. This is to be used with 2 CD4051 multiplexers.

int MuxPin1=2;
int MuxPin2=3;
int MuxPin3=4;
int AnaInPin1=4;
int AnaInPin2=5;

//Declare variables
int MuxVal1 = 0; 
int MuxVal2 = 0; 
int MuxVal3 = 0; 
int BinVal = 0; 
int N = 0; 

//BinPat is used for figuring out the High / Low (1/0) values of the MUX control pins
int BinPat [] = {000, 1, 10, 11, 100, 101, 110, 111};
//The PotValues array is used for storing the 16 vlues read from the potentiometers
int PotValues [] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

void setup()
  //Initialize digital pins and serial communication speed
  pinMode(MuxPin1, OUTPUT);
  pinMode(MuxPin2, OUTPUT);
  pinMode(MuxPin3, OUTPUT); 

void loop() {
  delay (10);

void readPotValues()
for (N=0; N<=7; N++) 
      BinVal = BinPat[N];      
      MuxVal1 = BinVal & 0x01;
      MuxVal2 = (BinVal>>1) & 0x01;
      MuxVal3 = (BinVal>>2) & 0x01;
      digitalWrite(MuxPin1, MuxVal1);
      digitalWrite(MuxPin2, MuxVal2);
      digitalWrite(MuxPin3, MuxVal3);
      PotValues[N]=analogRead(AnaInPin1) / 4 ;
      PotValues[N + 8]=analogRead(AnaInPin2) / 4;   
void sendPotValues()

for (N=0; N<=14; N++) 

I have adapted the code for my purposes but even the above does not compile. Arduino 0015 gives the error:

C:\DOCUME~1\ANDYDU~1\LOCALS~1\Temp\build49188.tmp\core.a(wiring_serial.c.o): In function `__vector_18':
C:\Arduino\arduino-0015\hardware\cores\arduino/wiring_serial.c:112: multiple definition of `__vector_18'
C:\DOCUME~1\ANDYDU~1\LOCALS~1\Temp\build49188.tmp\core.a(HardwareSerial.cpp.o):C:\Arduino\arduino-0015\hardware\cores\arduino/HardwareSerial.cpp:95: first defined here
Couldn't determine program size: C:\Arduino\arduino-0015\hardware/tools/avr/bin/avr-size: 'C:\DOCUME~1\ANDYDU~1\LOCALS~1\Temp\build49188.tmp\AnalogInput.hex': No such file

I assume lines 1 and 3 point to an issue and the others are secondary. Can someone tell me if there is anything I should add or change to MikMos code?

Change beginSerial(19200); to Serial.begin(19200);

That worked, old code form I guess.


Glad it helped!

It was a wierd error message, not easy to understand that it simply was a call to an undefined function that caused the error.