--- Paul: I tested the peak finding code with a potentiometer, then an IR sensor, and it worked fine. Then, I tried unsuccesfully to write a simplified version of the peak finding code, so that my sensor only sent out data when it's values changed at all. I was puzzled at the results. I got rid of the peak and threshold variables, as all I wanted to look for was if the values were changing. In this instance, all I cared about was if the values were increasing or not.
Main: ADCin 0, sensorValue If sensorValue > lastSensorValue + noise then serout2 PORTC.6, 16468, [DEC SensorValue, 13,10] endif lastSensorValue = sensorValue Goto main
When I wasn't doing anything, it would still jump around sending values (I guess I didn't set my noise value high enough), but it jumped up AND down, which confuses me, because in theory this should only be sending data when it is increasing. Also, in the middle of the Pot's range, the values stopped being sent for a while until I reached the upper portion of the range. Why? pf372 ---