Testing Testing…

Setting up the potentiometers to control the horizontal and vertical lines is fairly basic and should be relatively simple but will take you thru my odyssey nevertheless.

Test 1: I used the Arduino code from the Graphing a Sensor lab and proceeded to over-engineer it. In the Dimmer lab, I was unhappy that the potentiometer did not move the ball the full width of the screen and I thought I could overcome this by mapping the analogRead to the width of my screen dimension (1200 pixels). I also purchased what I thought was a better potentiometer than the one in our kits, in case that was the issue. Below is the code and the results. It worked in that I could produce a horizontal line. The problem however is I get a dotted line if I rotate the potentiometer to quickly.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Test 2: I tried re-purposing the code from the Graphing a Sensor lab and it worked much better. It now draws a smooth line no matter how fast the rotation. But of course there is a new problem to solve. When I open the sketch, the line draws from right to left, yet the potentiometer rotation is from left to right. The code is below – I’m sure the solution is blindingly obvious but I’m just tired trying right now. Time for a break…

And after staring at it again, I see the error in the Processing code… the fix is highlighted below in yellow. Works now – left to right rotation = line drawn from left to right on screen.

Comments are closed.