Example: Take the mean of the multiple sensors

Printer-friendly version

With so many variables and when so many things can go wrong why not use more than one sensor this will allow you to become more accurate consistently you will not be able to get a set number every time but you will be able to get a lot closer to the real number every time overall you give up a little bit of Persian to gain a lot of constancy.

Robot Build: 

How you need to space out the sensors

Printer-friendly version

The most important part is that the sensor needs to be in parallel if they are not your numbers will be really off. You also want to space them out so that if you of them picks up a magnetic field not all of them.


Attached Files: 

how you take the mean out of sensor readings

Printer-friendly version

#pragma config(Sensor, S1,     Right,          sensorI2CHiTechnicCompass)
#pragma config(Sensor, S2,     middle,         sensorI2CHiTechnicCompass)
#pragma config(Sensor, S3,     left,           sensorI2CHiTechnicCompass)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main
int Useme = ((Right+ middle + left)/3);
to put it simple you are using the 3 sensors and getting the mean of them you then useing that data to program your robot