In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Matthias09 wrote: Beau, thank you very much. I now understand the idea of the code. However I got one issue left: how much samples do I have to do to get an reasonable result? I just quickly checked in excel and there, with a constant sensor input reading of 200, I need at least 25 samples to get something around 200 back. I am measuring a moving object (ball rolling down a 2 feet long beam). It's not fast movement, but will the SX be able to calculate this 25 samples quick enough to be able to still provide a 'live' measurement? In theory, the algorithm can handle 218 samples, so I can handle the 25 required ones. (with DataPuffer as a WORD and a maximum sensor reading of 300, 65535/300 = 218). But sometimes the sensor skips occasionally to higher values (like 600 or even 3031, the maximum value). So should I built in a restriction first that the maximum value the sensor gives out is 300? Would I build a for...next statement around the code and make 25 loops for 25 samples? Thanks Beau. Lot's of questions for the genius code :) Matthias ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=175860#m382554 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)