Pages: [1]   Go Down
Author Topic: Upload Sketch from Processing?  (Read 1509 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 96
Why is it so?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it possible to upload a sketch via processing?
« Last Edit: October 25, 2010, 07:06:26 pm by 32teeth » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is it possible to upload a sketch via processing?
No. That wouldn't make any sense.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 96
Why is it so?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// firmata included
void setup(){}
void loop(){}
void customMethod(){}

Processing
Code:
/*
 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?
« Last Edit: October 26, 2010, 05:38:04 am by 32teeth » Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 96
Why is it so?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

any thought?
Logged

NYC
Offline Offline
Full Member
***
Karma: 0
Posts: 129
The singularity is near!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 96
Why is it so?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

« Last Edit: November 05, 2010, 07:43:52 am by 32teeth » Logged

NYC
Offline Offline
Full Member
***
Karma: 0
Posts: 129
The singularity is near!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: