Commit 6c5bcf14 authored by Patrick's avatar Patrick

added a distance calculation (assuming 765cm sensor)

parent b890f73f
......@@ -213,5 +213,10 @@ long red_peg::level(t_SensorData data_record, long max_level)
float red_peg::distance(t_SensorData data_record)
{
return -1.0;
if (data_record.the_command == ANA) {
long distance = map(data_record.the_reading, 0, 32767L, 0, 765L);
return distance;
} else {
return -1.0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment