Go Down

Topic: Upload Sketch from Processing? (Read 1 time) previous topic - next topic

32teeth

Oct 26, 2010, 02:06 am Last Edit: Oct 26, 2010, 02:06 am by 32teeth Reason: 1
Is it possible to upload a sketch via processing?

PaulS

Quote
Is it possible to upload a sketch via processing?

No. That wouldn't make any sense.

32teeth

#2
Oct 26, 2010, 12:34 pm Last Edit: Oct 26, 2010, 12:38 pm by 32teeth Reason: 1
let me clarify

the though was for processing to do some variable and config stuff.
then using the arduino.cc class and firmata on the chip be able to upload a sketch to processing.

with the answer provided above. a different approach is required.

I have played around with a blink on roll over sketch using processing and firmata to set HIGH or LOW the pin 13 LED.
In all the reference to the arduino library for processing i have not seen any instance where i can call a method that i have create on the arduino side.

let me describe

Arduino
Code: [Select]

// firmata included
void setup(){}
void loop(){}
void customMethod(){}


Processing
Code: [Select]

/*
some code ommited
*/
import processing.serial.*;
import cc.arduino.*;

Serial port;
Arduino arduino;

void setup()
{
  arduino = new Arduino(this, Arduino.list()[0], 57600);
}

void draw()
{
 background(#000000);
 fill(#000000);
 rect(0,0,200,200);
}

void mousePressed()
{
 /*
   i want to fire off a method called customMethod in the arduino code
   this doesn't work
 */

  arduino.customMethod();
}





This is the snippet i would like to work

void mousePressed()
{
 /*
   i want to fire off a method called customMethod in the arduino code
   this doesn't work
 */

  arduino.customMethod();
}


can this be done?

32teeth


Andy R

I hope this is what you are looking for, but I'm having trouble understanding.

You can create a processing sketch and an arduino sketch that talk to each other, but no where do they exchange code.

For example, the processing sketch could control the arduino by sending commands. The processing sketch could display icons like 'go forward' or 'stop'. When a mouse click is detected on either icon, processing sends to arduino over the serial connection a 'g' or a 's'. The arduino receives the command over the serial connection and based on a switch statement calls either the goForward() or stop() methods.

Configuration could be done the same way. Just define a bunch of commands in the arduino for setting configuration variables and have processing send them.

32teeth

#5
Nov 05, 2010, 01:43 pm Last Edit: Nov 05, 2010, 01:43 pm by 32teeth Reason: 1
Thanks Andy R

So my understanding then is from processing you can only pass variables that arduino needs to absorb and determine actions.
There is no way to call methods directly then? Would be a nice to have feature i guess, but the variable passing is acceptable.


Andy R

That's right.

Remote procedure calls is a big area in more sophisticated systems, but you don't expect them in systems like these. They can be very difficult to use.

And I'm glad you have all your teeth!

Go Up