Étape 4: taper
Import processing.serial.* ;
tweet de chaîne publique ;
PFont fnt ;
Arduino Serial ;
void setup() {}
taille (800, 100) ;
noStroke() ;
Background(0) ;
TPN = loadFont("CourierNew36.vlw") ;
textFont (TPN, 32) ;
Tweet = "" ;
println(Serial.List()) ;
String arduinoPort = Serial.list() [1] ;
Arduino = nouvelle série (ce, arduinoPort, 9600) ;
frame.removeNotify() ;
}
keyPressed() Sub {}
if(Key == 13) {}
Background(0) ;
sendTweet(tweet) ;
texte ("tweeté!", 10, 45) ;
Delay(1000);}
Si (clé > = ' "& & clés < = « z ») {}
Background(0) ;
clé de tweet de += ;
texte (tweet, 10, 45);}
if(Key == 8) {}
Background(0) ;
Tweet = tweet.substring (0, tweet.length()-1) ;
texte (tweet, 10, 45);}
Delay(150) ;
}
{} void draw()
listenForArduino();}
void listenForArduino() {}
input int = 0 ;
if(Arduino.available() > = 1) {}
entrée = arduino.read() ;
if(INPUT == 1) {}
frame.addNotify();}
}
}