In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Zoot wrote: Your code examples are not exactly the same; in the SX version you are presuming you will get an RCTIME of 0 -- seems unlikely as there will probably always be *some* capacitance. Your Stamp code debugs out the value; for the SX, use WATCH and then run the program in DEBUG mode with your Key connected. Then try it out and see what values you get for various light intensities -- once you have a decent threshold number established, then you can have an LED turn on and off based on that threshold [code] 'PWM.SXB DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 led2 PIN RB.2 led1 PIN RB.1 led7 PIN RB.7 light VAR Word time CON 2000 someThreshold CON 100 ' or whatever a good number ends up being WATCH light 'Code PROGRAM Start Start: led1 = 1 led2 = 0 DO OUTPUT led2 OUTPUT led1 RCTIME led1, 1, light IF light < SomeThreshold THEN led7 = 1 ELSE led7 = 0 ENDIF PAUSE time LOOP [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=364552#m364555 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)