We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › Processing wont communicate with Arduino
Pages: 1 2 
Processing wont communicate with Arduino (Read 9917 times)
Re: Processing wont communicate with Arduino
Reply #15 - Jul 19th, 2009, 11:00pm
 
I've tried the simpledigitalFirmata sketch and it works ok... (which makes me happy, and a bit ashamed of myself for not testing it before,  Tongue) , but without the potentiometer stuff... so I guess we'll  have to wait for the new version of the firmata software...

thanks a lot for the help...

and sorry for my English...
Re: Processing wont communicate with Arduino
Reply #16 - Jul 19th, 2009, 11:59pm
 
Good to hear that it works at least in part.

Remember, if you need more options, it is possible to write your own send/receive command set.

Some of the examples included with Arduino show how to send and receive data between Processing and the Arduino board.

You could send a message like 'serial.write("DO1");' from Processing and decode it in Arduino as 'digital out pin 1'.
Re: Processing wont communicate with Arduino
Reply #17 - Jul 20th, 2009, 10:14am
 
Thanks!  Smiley
Re: Processing wont communicate with Arduino
Reply #18 - Jul 20th, 2009, 10:24pm
 
Firsat of all thanks for the help and for the 'serial.write("DO1");' idea in the "arduino mega won't work!" post...
and I have another small question, but, as I'm a total newbie with the board and I don't know anyone who has it, I have no choice but to bother you:
Does the board make some digital noise? I mean.. when Processing reads a potentiometer, photoresistor, etc, It gives me nosies values, I mean, like ,845,870,920,870,905 a something like that, same with the pushbuttons, it reads on/off several time... I know I'm not working with a protoboard, I'm working on the air, and that it should be a good idea isolate the board... but, is it THAT sensible?
I hope I've made myself clear...
Thanks a lot in advance...
Re: Processing wont communicate with Arduino
Reply #19 - Jul 21st, 2009, 12:20am
 
It is common to get 'some' noise, but I have used a potentiometer with pretty stable input (it was on a proto board, though).

Make sure to connect both the positive and negative to the pot. so it creates a voltage divider circuit:

+5v o------/\/\/\/\/\-----o Ground
                   /\
                    |
                    |
                    * to analog input



I haven't tried a photoresistor... :\

As for the button, look up 'debouncing'.
To sum up debouncing; the Arduino is much faster than the mechanical switching of the button.
The contacts of the button can literally bounce off each other, causing multiple on/off states.
You will want to ignore the button input for a while after the first press is detected.
Re: Processing wont communicate with Arduino
Reply #20 - Jul 24th, 2009, 6:59am
 
Note the following code in IOModule.java---

} else if (foundPortName.startsWith("COM")) {
                                   theSerialPortName = "COM3";
                             }

Looks like someone hardcoded this to COM3 for a pc.

I changed this to

                             } else if (foundPortName.startsWith("COM")) {
                                   theSerialPortName = foundPortName;

to support the other COM ports.

I'm a bit confused here. I thought the funnel server was moderately mature but the first thing it does is send a +++ and when it receives a character the xbee is null (it hasn't been built yet).

Here's the code in Funnelio

     try {
           output.write(command);
           sleep(1500);
           output.write(apiModeCommand);
           sleep(100);
     } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
     }

     xbee = new XBee(this, output);


Is this library just really sloppy or is it because I'm a newbie and running stuff wrong?

Mark
Re: Processing wont communicate with Arduino
Reply #21 - Jul 25th, 2009, 1:47am
 
First thing that stands out is the creation of xbee after you send data to the output.

Does putting 'xbee = new XBee(this, output);' before the try block help?
Re: Processing wont communicate with Arduino
Reply #22 - Jul 25th, 2009, 1:09pm
 
Hi,

Yes, it gets rid of the startup exceptions if you move the block. My question is more in the nature of...

I'm considering using a funnel board in a home automation system but so far I've been very underwhelmed by the code. Hardcoded to COM3, exceptions out the wazoo, etc.

So far I've been unable to actually connect to the fio board and the error messages are useless. I have no issues with the XBee and two of them on usb communicate just fine, I just would like a tiny bit of processing power underneath to add control structure. I don't need the Processing application - which seems like a huge amount of overhead and abstraction - I just want something simple preferably programmable in Java or C.

I've tried a bitwhacker and it's really easy to create firmware, the doc is good, and the examples all work - but it doesn't have an xbee port on it.

Admittedly I'm a newbie at the funnel board so I thought I'd ask on the forum if it's just me.

Mark

Re: Processing wont communicate with Arduino
Reply #23 - Jul 26th, 2009, 12:27am
 
Actually, I am not familiar with Xbee.
I agree that it should not be hard coded to COM3.
Are sending messages to the Arduino and have it control the Xbee or trying to create a library for direct access similar to the Arduino library for Processing?

I found some references with a quick search:
http://funnel.cc/Hardware/FIO
http://www.ladyada.net/make/xbee/arduino.html
Re: Processing wont communicate with Arduino
Reply #24 - Oct 30th, 2009, 2:17am
 
Hi,

I'm desperately trying to get values from an IR proximity sensor attached to my arduino but all I get is zero. I use the standard firmata however I tried the analog input one. The arduino works perfectly, in max/msp it sends the values. Can you please help me with this sketch to get the sensor values:
Quote:
import cc.arduino.*;

import processing.serial.*;

import promidi.*;

Arduino arduino;

MidiIO midiIO;
MidiOut midiOut;

int sensorv;

void setup(){
  size(200,200);
  arduino = new Arduino(this, Arduino.list()[0], 57600);
  midiIO = MidiIO.getInstance(this);
  midiOut = midiIO.getMidiOut(1,"IAC Driver - Bus 1");

  midiIO.printDevices();
  println(Arduino.list());

}
void draw(){
  background(0);
  sensorv = arduino.analogRead(0);
  midiOut.sendController(new Controller(1,sensorv));
  println(sensorv);
}













Re: Processing wont communicate with Arduino
Reply #25 - Nov 1st, 2009, 2:51pm
 
What version of Standard Firmata are you running?  The one distributed with Arduino 0017 does not actually work.  The code has been corrected, but there has not been a new release of Arduino (0018) yet.
Re: Processing wont communicate with Arduino
Reply #26 - Dec 4th, 2009, 10:24pm
 
I'm suffering the same issue with my Mega.  Is this a confirmed issue with the Mega?  I also had success if I used the simpleDigitalFirmata, but I can only get the onboard LED to light up.  Even if I plug an LED into pin 13, the off board LED won't light up (I tested the same setup/script in Arduino and it works just fine).

Thanks for the help
Pages: 1 2