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";
}