When this sketch is executed this error results. What needs to be accomplished with this code is for 8 voltage readings from the 74HC4015 to be displayed on the serial monitor. I’m new to programming.
Thank you
AnalogMultiplexing:43: error: ‘Serial’ does not name a type
Serial.print("Raw Value = " );
AnalogMultiplexing:44: error: ‘Serial’ does not name a type
Serial.print(RawValue);
^
exit status 1
‘Serial’ does not name a type
int pin_Out_S0 = 8;
int pin_Out_S1 = 9;
int pin_Out_S2 = 10;
int pin_In_Mux1 = A0;
int Mux1_State[8] = {0};
//float Mux1_State[i] =0;
int RawValue=0;
float Voltage = 0;
void setup() {
pinMode(pin_Out_S0, OUTPUT);
pinMode(pin_Out_S1, OUTPUT);
pinMode(pin_Out_S2, OUTPUT);
pinMode(pin_In_Mux1, INPUT);
Serial.begin(9600);
}
void loop() {
RawValue = analogRead(pin_In_Mux1);
Voltage = (RawValue * 5.0) / 1024; //scale the ADC
updateMux1();
//Serial.println(Mux1_State);
for(int i = 0; i < 8; i ++) {
if(i == 7) {
Serial.println(Mux1_State[i]);
} else {
Serial.print(Mux1_State[i]);
Serial.print(",");
// vout = (value * 5.0) / 1024.0;
}
}
}
void updateMux1 () {
for (int i = 0; i < 8; i++){
digitalWrite(pin_Out_S0, HIGH && (i & B00000001));
digitalWrite(pin_Out_S1, HIGH && (i & B00000010));
digitalWrite(pin_Out_S2, HIGH && (i & B00000100));
Mux1_State[i] = analogRead(pin_In_Mux1);
}
}
Serial.print("Raw Value = " );
Serial.print(RawValue);