Society of Robots - Robot Forum
Software => Software => Topic started by: Razor Concepts on October 07, 2008, 05:56:44 PM
-
Hi, I just bought the Sharp IR sensor, the GP2Y0A21YK version (for my Axon). I noticed in sensors.c , there is no mention of the GP2Y0A21YK, closest one is the GP2Y0A02YK, which doesnt seem to work well. What code would be appropriate for my Sharp sensor? Thanks ;D
-
Ok I just wrote this code for you. Add it into sensors.c. It'll be included in all future Axon code versions. Let me know how well it works for you!
//Sharp GP2Y0A21YK IR Range Sensor - 4 cm to 30 cm
int sharp_IR_interpret_GP2Y0A21YK(int value)
{
return 739.38*pow(value,-.8105);
}
-
Thanks it works great. This also spurred me on to finally use the hyperterminal... and now I wish I had used it earlier, it should help a lot in trying to debug my code ;D