Basic Stamp reading a variable from Processing, no luck
federico
Posts: 6
Hi Everyone,
I'm trying to send a number with PROCESSING to be read by the Basic stamp 2 but so far no luck.
I'm using serin to read the number but nothing.
Any ideas on the code to use both for the Basic stamp and Processing? at this point i just need to check that they are able to communicate.
thanks a lot
Federico
I'm trying to send a number with PROCESSING to be read by the Basic stamp 2 but so far no luck.
I'm using serin to read the number but nothing.
Any ideas on the code to use both for the Basic stamp and Processing? at this point i just need to check that they are able to communicate.
thanks a lot
Federico
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Processing is this open source programming language that works with Arduino microcontroller, is close to wiring, and so far I have found several examples on how to read FROM the basic stamp (using serout) to processing but not the opposite. the thing is that this language is getting really powerful in the physical computing scope and is being used for a lot of art projects incorporating microcontrollers
the web page of processing is
http://processing.org/
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Are you sure Processing has the capability to use a COM port by itself or does it depend on calling another program?
As Chris suggested, having a few sections of your code (from both sides) would enable much fuller answers.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
Are you using the Processing Libraries, ...\processing-0135\processing-0135\reference\libraries\index.html, the SERIAL library, ...\processing-0135\processing-0135\reference\libraries\serial\index.html,·and its methods/etc?· (Look in your Processing Help/Reference for the documentation.)
PAR
some code:
import processing.serial.*;
Serial myPort; // The serial port
void setup()
{
background(255);
size(SCREEN_WIDTH ,SCREEN_HEIGHT);
setUpTextProperties();
setTextColor();
allNums = new ArrayList();
println(Serial.list());
myPort = new Serial(this, Serial.list(),
9600);
}
void draw()
{
currentFrame++;
if (currentFrame >= Long.MAX_VALUE)
{
currentFrame = 0;
}
if (currentFrame % TEXT_UPDATE_FREQ == 0)
{
getNums();
if (isThereANumber())
{
makeFinalNum();
}
}
text(finalNum, textHPos, textVPos);
sendSerial();
receSerial();
delay(10);
}
void sendSerial ()
{
myPort.write(finalNum);
}
void receSerial ()
{
while (myPort.available() > 0)
{
int inByte = myPort.read();
println(inByte);
}
}
And was is happening is that it just doesn't do anything- no errors, and the rest of
the code is running fine, but these parts might as
well not have been there (println is like the "debug" and it is not printing
anything.)
DO
DEBUG "Hello World!", CR
pause 5000
LOOP
Download the code to the stamp and check to see if it prints Hello World! in the debug screen. If that works close the stamp editor and try reading the stamp from your program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen