for this week we practised the serial communication between arduino and processing.
for the first part i was instructed to make a Etch A Sketch with arduino and processing. we used two potentiometers, each of which controls the x or y position of a circle on the screen.
one thing to keep in mind is that for the example we downloaded, the processing part actually reads “serial.print()” in arduino. so that’s why when i used serial.write() things don’t work. also for the first version i am about to show, i wonder if i could make the elipse smaller and also shorten the delay time and make the animation actually look like a line…… for the second version i simply connects two sets of read value (x,y) using a line(). this way things connect with each other…… however this new verison is still a bit chuncky (if that make sense) due to the delay time but my computer just seems to refuse to change the default delay time smh.
for the second part we didn’t have time to do it but i would imagine the process not being too hard. according to the video all there is to do is detect the mouseX and mouseY value, map them and send them to arduino where we use the tone() fuction and take the mapped x value as frequency and y value as duration. and only when key pressed and key is the space key can the two value be sent. the circuit would be simply a buzzer connected to a pin.