I'm currently sending a string of serial data into processing. I'm using
readStringUntil to end the read of the serial buffer. However, I need to read another (different) data string after receiving the first. Is there anything that will 'readStringFrom'?
I'm trying to search a word on twitter and then pick out keywords within the tweets. For example, searching for 'weather' on Twitter and then adding up how many times people mentioned 'sun', 'rain' etc.
I'm unsure how to scan and add-up the words. Code so far below. Thanks.
twitter4j.Twitter twitter;
void setup() {
twitter = new TwitterFactory().getInstance();
try {
Query query = new Query("weather");
QueryResult result = twitter.search(query);
List<Tweet> tweets = result.getTweets();
for (Tweet tweet : tweets) {
println(tweet.getText());
}
} catch (TwitterException te) {
te.printStackTrace();
println("Failed to search tweets: " + te.getMessage());
I'm basically recording footage while displaying other video. Everything works apart from one thing. The frame-rate of the recorded .mov file is way too fast. The recording time is 6 seconds, however the exported .mov file is 3 secs.
W
hat it seems to be is the higher the size() is, the faster it'll play back.
It'll work normally at 200x200 pixels, but the exported video gets faster and faster the higher the resolution is.
Any ideas why?
import jmcvideo.*;
import processing.video.*;
import processing.serial.*;
Capture myCapture;
Serial arduino;
MovieMaker mm;
boolean video = false;
JMCMovie myMovie;
int counter = 1;
int vidCounter = 0;
void setup() {
size(1440, 900, P2D);
frameRate(25);
// size(320, 240, P2D);
mm = new MovieMaker(this, width, height, "drawing" + counter + ".mov",
25, MovieMaker.JPEG, MovieMaker.BEST);
myCapture = new Capture(this, width, height, 25);
myCapture.settings();
myMovie = movieFromDataPath("drawing0.mov");
myMovie.loop();
arduino = new Serial(this, Serial.list()[0], 9600);
background(0);
}
void draw() {
{
byte[] inBuffer = new byte[7];
while (arduino.available () > 0) {
inBuffer = arduino.readBytes();
arduino.readBytes(inBuffer);
if (inBuffer != null) {
String myString = new String(inBuffer);
println(myString);
delay(200);
// if (keyPressed) {
// if (key == ' ') {
if (myString.equals("A")) {
video = true;
arduino.clear();
}
else if (myString.equals("?")) {
video = false;
delay(200);
println("finished :)");
mm.finish();
background(0);
arduino.clear();
delay(200);
counter++;
delay(500);
mm = new MovieMaker(this, width, height, "drawing" + counter + ".mov",
I'm looking to play a few videos inside void draw. These videos are going to be created after void setup, so I can't initialise them first. To simplify things, I've taken the basic play movie example and swapped the video initialisation into the void draw. This is pretty much how my sketch works. I get this error message and the video doesn't seem to play.
"java(1109,0xac0b62c0) malloc: *** error for object 0x130d950: double free
*** set a breakpoint in malloc_error_break to debug"
when the simplified code is:
import processing.video.*;
Movie myMovie;
int counter = 0;
void setup() {
size(350, 260, P2D);
}
void draw() {
myMovie = new Movie(this, "drawing"+counter+".mov");
I know its possible to draw images from a webcam in Processing. However, is it possible it key out a background colour from the webcam feed to reveal a still image?
This loads one image, but when mousePressed doesn't pull another one. I'm guessing thats because the randomimage is in void setup? Any help to do this would be appreciated!
This currently pulls through my @ replays when the script starts up with no serial command (thats coming later). Where I would like help is as follows..
I would like the sketch to count how many NEW tweets have come through since the last time it checked. Any ideas?