question about controlling RC car with X,Y coordinates in a if() function
in
Programming Questions
•
1 year ago
im trying to control a rc car like this
touchOSC (app on ipod) -> processing -> arduino -> controller -> RC car
however we want to use a 200x200 X,Y interface on touchOSC to control the RC car.
my only problem right now is the coding in processing, i want it to do the following
if (x>50 && y<50), the RC car should go left
if (x<150 && y<50), the RC car should go right
im not sure how to program this because im using an example as reference.
---------------------------------------------------------
// when OSC packets are received
void oscEvent(OscMessage theOscMessage) {
// set the current address to the control name
String addr = theOscMessage.addrPattern();
// get the value of the control
float val = theOscMessage.get(0).floatValue();
// if the control toggled is toggle1, then toggle float value
if(addr.equals("/1/xy1")) { v_toggle1 = val; }
-------------------------------------------------------------
however this example makes use of buttons and i want it to work with x,y coordinates instead.
my friend tells me i cant replace addr with the x,y coordinates...so i don't really know how to continue from here.
Could someone help me with this?
1