In SX Microcontrollers, SX/B Compiler and SX-Key Tool, jmokie wrote: First time SX user, not familiar with machine code, former STAMP user and a electronics hacker needs help. I'm trying to use the a/d method in the sample code for the SXB on an SX28AC to read the output of a line sensor output to do PID control on the motors of my robot. I'm using the Vishay TCRT5000 reflex detector. The code is straight out of the example I am trying to scale the output in a usable range. The ckt is attached. Right now with the resistors shown, the transistor collector reads: 0.181 vdc with white resulting in .48 ma 3.08 with black resulting in .192 ma Which sounds like a good range. But the a/d, monitored with the Watch/Poll command in the Debug mode, starts counting at 0 or 1 @ 0.3vdc on the collector and reaches 240 @2.67 vdc, which is really dark grey. I would like to have 0 counts = white and 255 = black My sensor has the emitter tied to gnd on the ckt board, so putting another resisor in the emitter ckt means more cut-n-kludge. Hoping for some advice that will give a better range in counts. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=152780 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)