Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
reaperisonline
reaperisonline's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
question about controlling RC car with X,Y coordinates in a if() function
[4 Replies]
26-Mar-2012 10:12 AM
Forum:
Programming Questions
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?
«Prev
Next »
Moderate user : reaperisonline
Forum