twitter code mod for dog shock collar.

by Mishugana @ 11:14 pm 20 April 2010

import processing.serial.*;
XMLElement xml;
ArrayList Followers = new ArrayList();
Serial myPort;
int temptime=0;
void setup() {
  size(200, 200);
   if (myPort!=null)
   myPort.stop();
   myPort=null;
  xml = new XMLElement(this, “http://rssfriends.com/followers/waffleshop“);
  XMLElement site = xml.getChild(0);
  XMLElement[] siteData = site.getChildren();
  for (int i=0;i<site.getChildCount();i++){
  if(siteData[i].getName().equals(“item”)){
    String sttt =(siteData[i].getChild(0).getContent());
    String[] tokins = split(sttt, ” “);
    if(tokins[0].equals(“Follow”))
    Followers.add(tokins[1]); 
   // if(tokins[0].equals(“Unfollow”))
   // println(tokins[1]);} 
}}}
boolean searchArray(ArrayList alist, String lf) {
  for(int i = 0; i < alist.size(); i++)
    if (alist.get(i).equals(lf))
    return true;
 return false;
}
void draw() {
  background(255);
  xml = new XMLElement(this, “http://rssfriends.com/followers/waffleshop“);
  XMLElement site = xml.getChild(0);
  XMLElement[] siteData = site.getChildren();
  for (int i=0;i<site.getChildCount();i++){
  if(siteData[i].getName().equals(“item”)){
   if (myPort!=null)
    myPort.stop();
    myPort=null;
    String sttt =(siteData[i].getChild(0).getContent());
    String[] tokins = split(sttt, ” “);
    if(tokins[0].equals(“Follow”))
    if (!(searchArray(Followers,tokins[1])))
    {
         if (myPort!=null)
        myPort.stop();
        myPort=null;
      println(tokins[1]);
      temptime=millis();
     
      while ((millis()-temptime)<1000)
      {
      if (myPort==null)
      myPort=new Serial(this, Serial.list()[0], 9600);
      }
 
    Followers.add(tokins[1]); 
    }
}
}}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2016 Special Topics in Interactive Art & Computational Design | powered by WordPress with Barecity