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.
Page Index Toggle Pages: 1
Bluesense board (Read 950 times)
Bluesense board
Nov 26th, 2007, 11:15pm
 
hi, advanced users

today, there was a small workshop on physical computing with a guy who manage a company for some arduino/wiring like boards called bluesense:

http://www.bluemelon.org/index.php/Products/BlueSense_and_Processing

it was fun but the problem is, that the guy has absolutely no experience with P5, and he only knows Max/msp,

so he could not help me on a problem.
when i lauch this simple code, which just do a very simple drawing with pressure sensor,


import org.bluemelon.bluesense.*;


Master master;
AdcInputDevice adcIn;

int last;
int id;
int pin;

boolean setupAnalogIn() {


System.out.println("Detecting device "+id+" \n");

// try to find our device within the next 5 seconds

Device dev = master.detectDevice(id, 5 * 1000 * 1000);


// device not found?

if(dev==null) {


System.err.println("Device "+id+" not found!\n");



return false;

}


adcIn = (AdcInputDevice)dev;


// setup analogue input for 2.56V, 5 samples/sec and 10-bits resolution

adcIn.requestSetConfiguration(2560, 5, 10);


return true;
}

void setup()
{

adcIn = null;

master = new Master();


// type your switchInputDevice id
       id = 1636;
       //  the input pin
       pin = AdcInputDevice.ADCINPUT_P1;

if (setupAnalogIn()) {


// call yield every 1 ms.


master.start(10);

}

       size(1000,800);
       smooth();
       frameRate(10);
       background(0);
}



void draw()
{
 float x = adcIn.getLastSampledInput(pin);
 


   ellipse(x,height, 100,100);
   


 }
 





/*public void stop() {
 System.out.println("stopping...");
 master.close();
 System.out.println("stopped");
}*/


then, it launches applet, and few seconds later, it quits while leaving P5 IDE untouched, but the applet quits suddenly...

the guy has no idea why it does so, and I'm not able to find out if it's the problem with board or if I did something wrong in my code. (I already tried to reduce the frameRate and I think the code is too simple that I can't even imagine where could be an error)

anyone has any idea?

thanks,

Re: Bluesense board
Reply #1 - Nov 27th, 2007, 8:43am
 
i don't know that board and most of the code seems to be related to it .. but a blind guess would be to put size(...,...) at the beginning of setup.

F
Re: Bluesense board
Reply #2 - Nov 27th, 2007, 9:48am
 
I just can't believe it,
but it works.
is it some kind of joke?? placing size() in front...
but it works!!!

thank you very much!

Re: Bluesense board
Reply #3 - Nov 27th, 2007, 10:31am
 
quoting from here:
http://processing.org/reference/size_.html

"The size() function must be the first line in setup()."

Smiley

F
Page Index Toggle Pages: 1