Arduino Serial problem after exporting
in
Integration and Hardware
•
2 years ago
Hi,
I have a problem with the serial connection, after I'm exporting my Processing sketch.
If i click on "run" in the processing IDE, it runs perfectly but if I start the "sketch.jar" file ,nothing happens. If i open the "index.html" file, the place for the applet is blank ...
This is just a simple "Click green, LED on, Click red, LED off" program.
The Arduino Code:
Can somebody help me to solve this problem? I searched for like three hours but can't find anything. Just people who have the same problem but never got an answer :(
Best Regards,
HammerH
I have a problem with the serial connection, after I'm exporting my Processing sketch.
If i click on "run" in the processing IDE, it runs perfectly but if I start the "sketch.jar" file ,nothing happens. If i open the "index.html" file, the place for the applet is blank ...
This is just a simple "Click green, LED on, Click red, LED off" program.
The Arduino Code:
void setup()
{
Serial.begin(9600);
pinMode(8, OUTPUT);
digitalWrite(8, LOW);
}
void loop()
{
if(Serial.available())
{
int wert = Serial.read();
digitalWrite(8, wert);
}
import processing.serial.*;
Serial port;
void setup() {
background(200);
port = new Serial(this, Serial.list()[0], 9600);
size(200,100);
}
int a = 0;
void draw() {
background(200);
fill(0,255,0);
rect(25,25,50,50);
fill(255,0,0);
rect(125,25,50,50);
if(mouseX>=25 && mouseX <= 75)
{
if (mousePressed)
{
a = 1;
port.write(a);
}
}
if (mouseX>=125)
{
if (mousePressed)
{
a = 0;
port.write(a);
}
}
}
Can somebody help me to solve this problem? I searched for like three hours but can't find anything. Just people who have the same problem but never got an answer :(
Best Regards,
HammerH
1