I would like to host on an external server SharedCanvasServer.pde, so anyone getting to the corresponding webpage could draw on my PC SharedCanvasClient display window. How can I do that?
Should I put the sketch in an HTML file the way Processing.js does it?
I tried to use the Arduino Labs tutorial for the Accessory mode (
http://labs.arduino.cc/ADK/AccessoryMode) on my Samsung Galaxy 10.1 tab with no success. The Arduino examples (e.g.: analogread) uploads alright on the Mega ADK board, but for the corresponding Processing example I get the following error message:
TEST TEST: 4
Arduino_ADK 0.1a
by D. Cuartielles, A. Goransson
at
http://arduino.cc,
http://1scale1.com D:\And
Exception in thread "Thread-12" java.lang.NoSuchMethodError: cc.arduino.adk.processing.MyBuild.preprocess(Ljava/io/File;Ljava/lang/String;Lprocessing/mode/java/preproc/PdePreprocessor;)Ljava/lang/String;
at cc.arduino.adk.processing.MyBuild.createProject(Unknown Source)
at cc.arduino.adk.processing.MyBuild.build(Unknown Source)
at cc.arduino.adk.processing.MyCompileThread.compileAndUpload(Unknown Source)
at cc.arduino.adk.processing.MyCompileThread.run(Unknown Source)
Android SDK is in the D:\And folder. My OS is Windows 7.
Any help?
PS: the ADB mode works alright, though!
When I try to export as a Windows application the example "Loop" of the GSVideo distribution I get an .exe OK, but if I run it, it gives a blank screen with just the stop button.
I use Vista and Processing 1.2.1
Any idea why?
I have sketch with videos and sounds which is working fine, but when I try to export it I get the following error message:
"
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at processing.app.Base.loadBytesRaw(Base.java:1784)
at processing.app.Sketch.exportApplication(Sketch.java:2268)
at processing.app.Sketch.exportApplication(Sketch.java:2098)
at processing.app.Sketch.exportApplicationPrompt(Sketch.java:2082)
at processing.app.Editor$46.run(Editor.java:1998)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
"
Does anyone know what can be the cause of this problem?
Thanks!
If I merge an example given in the Processing Serial distribution, "Simple Read" with an example given in Ardiuno Communication distribution "Physical Pixel" I get one code for the Arduino:
const int ledPin = 13; // the pin that the LED is attached to int incomingByte; // a variable to read incoming serial data into int switchPin = 4; void setup() { // initialize serial communication: Serial.begin(9600); // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); pinMode(switchPin, INPUT); }
void loop() { // see if there's incoming serial data: if (Serial.available() > 0) { // read the oldest byte in the serial buffer: incomingByte = Serial.read(); // if it's a capital H (ASCII 72), turn on the LED: if (incomingByte == 'H') { digitalWrite(ledPin, HIGH); } // if it's an L (ASCII 76) turn off the LED: if (incomingByte == 'L') { digitalWrite(ledPin, LOW); } }
if (digitalRead(switchPin) == HIGH) { // If switch is ON, Serial.print(1, BYTE); // send 1 to Processing } else { // If the switch is not ON, Serial.print(0, BYTE); // send 0 to Processing }
delay(100); }
and another on for Processing:
import processing.serial.*;
float boxX; float boxY; int boxSize = 20; boolean mouseOverBox = false; int val; Serial port;
// List all the available serial ports in the output pane. // You will need to choose the port that the Arduino board is // connected to from this list. The first port in the list is // port #0 and the third port in the list is port #2. println(Serial.list());
// Open the port that the Arduino board is connected to (in this case #0) // Make sure to open the port at the same speed Arduino is using (9600bps) port = new Serial(this, Serial.list()[2], 9600);
}
void draw() { if ( port.available() > 0) { // If data is available, val = port.read(); // read it and store it in val } //background(255); // Set background to white if (val == 0) { // If the serial value is 0, fill(0); // set fill to black } else { // If the serial value is not 0, fill(204); // set fill to light gray } rect(50, 50, 100, 100);
// Test if the cursor is over the box if (mouseX > boxX-boxSize && mouseX < boxX+boxSize && mouseY > boxY-boxSize && mouseY < boxY+boxSize) { mouseOverBox = true; // draw a line around the box and change its color: stroke(255); fill(153); // send an 'H' to indicate mouse is over square: port.write('H'); } else { // return the box to it's inactive state: stroke(153); fill(153); // send an 'L' to turn the LED off: port.write('L'); mouseOverBox = false; }
// Draw the box rect(boxX, boxY, boxSize, boxSize); }
Unfortunately, only the square is changing color on the computer side and the led is not blinking on the Arduino.
Apparently, I got a problem with the serial communication.
I would appreciate some help! Thanks!