Write the Arduino C code to setup and then read the analog v

Write the Arduino C code to setup and then read the analog value on pin A2. Assume the pin is initially in an unknown configuration. Integrate this into the SCPI sketch provided to your 2 weeks ago (see attached code). Follow the SCPI command structure as defined in SCPI-99.pdf. The filename for your code Last_Name_arduino.ino Remember to comment your code. MEAS:VOLT:DC A2

Solution

const int analogPin = A2; // component connected to analog pin 2   

// const is used to keep the value as constant
void setup()

{

Serial.begin(9600); // setup serial communication

}


void loop()

{

int value = 0; // declaration of variable storing the value which is read

value = analogRead(analogPin); // reading the analog input pin2

Serial.println(value); // to print the value read from analog pin A2

}

 Write the Arduino C code to setup and then read the analog value on pin A2. Assume the pin is initially in an unknown configuration. Integrate this into the SC

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site