can anybody help with analog read function in this program

This analog read function reads an analog value at one of pins (not sure if analog pins or serial pin) . i need to write the code to read the analog value and check it with serial monitor in IDE. I ma not able to identify to which the function is returning the read value. can anybody help please. Thanks

AnalogSensor::AnalogSensor(int channel) : Sensor(channel), scale_(1.0f), offset_(0.0f) {}

bool AnalogSensor::set(char* param, char* value) { // Set analog scale. if (!strncmp("scale", param, 6)) { float s = atof(value); scale(s); return true; } // Set analog offset. else if (!strncmp("offset", param, 7)) { float o = atof(value); offset(o); return true; } // Return false for unknown command. else { return false; } }

void AnalogSensor::scale(float scale) { scale_ = scale; }

float AnalogSensor::scale() { return scale_; }

void AnalogSensor::offset(float offset) { offset = offset_; }

float AnalogSensor::offset() { return offset_; }

char* AnalogSensor::name() { return "analog"; }

char* ES2::name() { return "es2"; }

There are plenty of simple examples of how to read an analog input. Your code is rubbish.

Where in heavens name did you get that code ? Forget modifying it and start again.

What sensor do you have, how is it to be connected to the Arduino.

Mark

If you open your IDE, got to File/Examples/03.Analog there are examples. (the first is a bit rubbish - it uses "map" with an incorrect range when a simple divide by 4 would suffice, but it will give you the basic idea)