I wonder if anyone could be bothered helping a puzzled newbie. It would be much appreciated.
Using an Arduino Uno, analogue reading a pot, sending it to a Pentium 4 for screen ouput in the form of a moving needle.
Very jerky needle movement and obviously dropping lots of data. I understood “myPort.bufferUntil(’/n’)” (see code) would throttle transmission. Is there any way of damping the needle movement to a smooth sweep? Tried everything — need suggestions (eat more fish ??).
float temp, diff;
int HYSTERESIS = 1;
sensVal = analogRead(0);
for (int i=0;i<10;i++)
sensVal = sensVal + analogRead(0);
sensVal = sensVal/10;
diff = abs(sensVal - temp);
if (diff <= HYSTERESIS)
sensVal = temp;
temp = sensVal;
void setup ()
myPort = new Serial(this, “COM18”, 9600);
void serialEvent(Serial myPort)
String val = myPort.readStringUntil(’\n’);
if(val != null)
val = trim(val);
angle = float(val);
line(angle, height, angle, 0);