please, i need any help
i has four analog inputs
when i program them ,my data is not correct
but when i program two analog input ,data is correct
arduino is DUE
please any help
MY CODE
/* simple analog in – multiple inputs
- —————-
*this takes multiple analog signals and returns their values
*/
int analog0 = A0; // select the input pin for the potentiometer
int analog1 = A1; // select the input pin for the potentiometer
int analog2 = A2; // select the input pin for the potentiometer
int analog3 = A3; // select the input pin for the potentiometer
int analogVal0 = 0; // variable to store the value coming from the sensor
int analogVal1 = 0; // variable to store the value coming from the sensor
int analogVal2 = 0; // variable to store the value coming from the sensor
int analogVal3 = 0; // variable to store the value coming from the sensor
float v1;
float v2;
float v3;
float v4;
//
//float v1_f;
//float v2_f;
//float v3_f;
//float v4_f;
//
//float v1_old;
//float v2_old;
//float v3_old;
//float v4_old;
//float a=0.015;
void setup() {
Serial.begin(9600); // use the serial port to send the values back to the computer
}
void loop() {
analogVal0 = analogRead(analog0); // read the value from the sensor
analogVal1 = analogRead(analog1); // read the value from the sensor
analogVal2 = analogRead(analog2); // read the value from the sensor
analogVal3 = analogRead(analog3); // read the value from the sensor
v1=(3.3analogVal0)/1023;
v2=(3.3analogVal1)/1023;
v3=(3.3analogVal2)/1023;
v4=(3.3analogVal3)/1023;
Serial.print(" "); // print the value to the serial port
Serial.print(v1); // print the value to the serial port
Serial.print(" "); // print the value to the serial port
Serial.print(v2); // print the value to the serial port
Serial.print(" "); // print the value to the serial port
Serial.print(" "); // print the value to the serial port
Serial.print(v3); // print the value to the serial port
Serial.print(" "); // print the value to the serial port
Serial.println(v4); // print the value to the serial port
}