We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
refresh URL loadString (Read 1320 times)
refresh URL loadString
Mar 19th, 2009, 3:56pm
 
Hello!
I am currently writing values to the serial port based on the content of a blog. When new comments are added a value is sent. Now I upload the content and have the program running in the background but it doesn't quite respond to the changes. Is there are a way to refresh the loadStrings or is that the issue?

Code:

import processing.serial.*;
Serial myPort;
int oldValue;
int newValue;


void setup(){
 println(Serial.list());
 myPort = new Serial(this, Serial.list()[1], 9600);
 oldValue = 0;
}

void draw(){
 
 String lines[] = loadStrings("http://urbanmyst.wordpress.com/");
 newValue = lines.length;
 print(newValue);
 if (newValue > oldValue){
 println("Value increased!");
   myPort.write('H');
   oldValue = lines.length;
 }else if (newValue == oldValue){
   myPort.write('L');
 }
 delay(100);
}


Page Index Toggle Pages: 1