Adding a moving object on command that is read through serial port

Rick H. William's picture

Offline

Joined: Nov 27, 2019

Replies: 6
Adding a moving object on command that is read through serial port
December 2, 2019 - 3:31am

I was wondering if anyone could help me with processing code where processing is reading the value of a button (on or off) and I want to have an ellispe that is added when the button is pressed down. Everytime ive tried to code it, the ball is added and when i take my finger off the button (off) the ellipse then is removed. How can I code it so that the ball stays?

 

Ashutosh's picture

Offline

Joined: Aug 27, 2018

Replies: 16
you have to stop cleaning the canvas
December 2, 2019 - 12:36pm

Remove the line that updates the background. You should have line like

 background(0);

inside your draw() loop just remove it and your ellipse will not be removed after you take your finger off. Providing your code here would make it more easy to help you