go_away

Author Topic: Sharp Code for GP2Y0A21YK  (Read 2945 times)

0 Members and 1 Guest are viewing this topic.

Offline Razor ConceptsTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Sharp Code for GP2Y0A21YK
« 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

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Sharp Code for GP2Y0A21YK
« Reply #1 on: October 07, 2008, 10:41:49 PM »
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!

Code: [Select]
//Sharp GP2Y0A21YK IR Range Sensor - 4 cm to 30 cm
int sharp_IR_interpret_GP2Y0A21YK(int value)
{
return 739.38*pow(value,-.8105);
}

Offline Razor ConceptsTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: Sharp Code for GP2Y0A21YK
« Reply #2 on: October 08, 2008, 04:59:43 PM »
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

 


Get Your Ad Here