I didn't know arduino would communicate with the PC directly without serproxy to translate the data.
if(bytesread == 10) { // if 10 digit read is complete
Serial.print("TAG code is: "); // possibly a good TAG
Serial.println(code); // print the TAG code
}
Instead of Serial.println(code); I would like to do something similar to Open.file(video.mpeg);
I hope this makes more sense, I tried using flash as the program that runs the video but it gets very complicated.
sorry, but the player program is on your pc, so no way..
You have to write a driver (a program) that listen the code from the serial and execute the Open.file(video.mpeg);
at least arduino can send not the code but directly the video's name.
I have been trying to use flash, I have tried using Firmata, I have tried using serproxy, they work to an extent but the thing that I want to do is a lot more basic than the examples that I am finding.
As far as I know the serproxy is putting the arduino onto a network to allow communication. The RFID reader prints out when it works and I want flash or any daemon file to recognise that it has printed and play the video.
because flash can't read the serial, you have to use serproxy:
serproxy is a TCP and serial server. It reads the incoming connection from serial and output it in it's TCP stream, and vice-versa.
it IS a complication because a "missing" of flash.
try using java ( RXTX is the library for serial, it's the same used by arduino :) )
Use Qt in Windows, Linux and Mac, its C and C++, or use GTK or Visual Studio, use a prgramming language and not that stupid Action Script, and 10 layers of interfaces just to use a serial port.
@Senso:
I quote for "use a prgramming language and not that stupid Action Script, and 10 layers of interfaces just to use a serial port."
but is not good for a beginner "Use Qt". just my 5 cent
read my last post before surrender, it's really easy!
processing have many tutorial (also for arduino), with a bit of cut-paste and little programming skill it can be done
the "play" button in processing will compile AND run your code, so no need to export while tesing.
java file has to be manually compiled (pain for noob!)
jar file are easier: java -jar filename.jar :-)
At the moment I am coming up with a null pointer error referring to the video, do I have to declare the full directory name of the video or do I copy the video into the sketch folder?
I cannot test until the errors have stopped appearing.
Where exactly will the video play in processing? I can see the details on the bottom but dont understand how a video will be played.
void setup() {
// List all the available serial ports
println(Serial.list());
// I know that the first port in the serial list on my mac
// is always my Keyspan adaptor, so I open Serial.list()[0].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[1], 9600);
//Video Code:
size(200, 200);
myMovie = new Movie(this, "video.mpg");
myMovie.play();
}
At the moment I am coming up with a null pointer error referring to the video, do I have to declare the full directory name of the video or do I copy the video into the sketch folder?
yes, the video has to be put in the project folder located in processing's sketchbook folder. Or you can use absolute path
4kingrich:
I cannot test until the errors have stopped appearing.
Where exactly will the video play in processing? I can see the details on the bottom but dont understand how a video will be played.
Movie class probably has a setSize() method, in witch you set the video's window dimension.
your code is not right:
in draw you have to look if you have received a full command.
for example in case the command is long 4 char:
while (myPort.available() > 4) {
read the code:
String command = myPort.read()+myPort.read()+myPort.read()+myPort.read(); //read 4 char. it isn't and addiction but a string of 4 char
then load the video (in this case same name than the command) and play it
myMovie = new Movie(this, command+".mpg");
myMovie.play();
end the if
}
and now paint the frame if we already loaded a video:
if (myMovie != null){
image(myMovie, 0, 0);
}
The arduino code is printing a 10 digit number over the serial like this: 3600A9C9F8
I have renamed my video to 3600A9C9F8.mpg and placed it in the Processing/sketch_apr05a/ folder.
So my serial needs to read the 10 digits like this:
String command = myPort.read()+myPort.read()+myPort.read()+myPort.read()+myPort.read()
+myPort.read()+myPort.read()+myPort.read()+myPort.read()+myPort.read();