Hello! For a school project, my partner and I decided to try to control happenings on a screen via processing, via the arduino. We have an idea for a basic "racing game" where two players can spam the switch button and have their object on the screen move.
We got one switch button to work, but we have no clue as to how to get a second image to move. I'm not even too sure how I should be googling this question, so I thought I'd turn to the arduino community. (and also the processing community)
Any suggestions or referrals for things I can look at? The idea thus far is to have two breadboards with switch buttons, which I think should be fairly straightforward. Then having each one plugged to a single arduino, plugged into processing.
I am a complete beginner so even just some suggestions that would put me in the right direction would be fantastic!
//code for processing import processing.serial.*; Serial port; int val; int x=0; void setup() { size(600, 600); noStroke(); frameRate(10); println(Serial.list()); // print a list of all available ports port = new Serial(this, Serial.list()[0], 9600); // choose the port to which the Arduino is connected // on the PC this is usually COM1, on the Macintosh // this is usually tty.usbserial-XXX } void draw() { println(port.available()); if (0 < port.available()) { val = port.read(); println ("----" + val); }
frameRate(60); background(252,252,176); //to ensure it doesn't go off the screen if (x>width) { //when ellipse is past width, start moving backwards) x=0; }