Étape 4: Etape 4-traitement de diffusion d’émissions pour GUI
/ * Interface graphique par Mechanic37
GUI1-Leds de contrôle www.mechanic37.com * /
Import processing.serial.* ;
Serial myPort ;
int r, g, b ;
String M1 = « 30D » ;
String M2 = « 60D » ;
String M3 = « 90D » ;
String M4 = « 180D » ;
String M5 = « MECHANIC37 GUI » ;
void setup() {}
Size(500,500) ;
r = 0 ; g = 0 ; b = 0 ;
println(Serial.List()) ;
String portName = Serial.list() [0] ;
myPort = nouvelle série (ce, portName, 9600) ; }
{} void draw()
Background(255) ;
remplir (255,255,255) ;
Fill(#279B61) ;
Rect(90,125,300,130,20) ;
Fill(255) ;
Rect(115,150,100,75,5) ;
Rect(265,150,100,75,5) ;
Fill(#279B61) ;
Rect(90,275,300,130,20) ;
Fill(255) ;
Rect(115,300,100,75,5) ;
Rect(265,300,100,75,5) ;
textSize(20) ;
remplir (255) ;
Text("Press-A",130,145) ;
Text("Press-B",280,145) ;
Text("Press-C",130,295) ;
Text("Press-D",280,295) ;
textSize (30) ;
remplissage (# 216 09) ;
texte (M1, 140, 200) ;
texte (M2, 285, 200) ;
texte (M3, 140, 350) ;
texte (M4, 279, 350) ;
Fill(#279B61) ;
texte (M5, 100, 100) ;
}
keyPressed() Sub {}
commutateur (keyCode) {}
case « A » :
myPort.write('1') ;
Fill(255,0,0) ;
Rect(100,150,100,75,5) ;
rupture ;
case « B » :
myPort.write('2') ;
Fill(255,0,0) ;
Rect(250,150,100,75,5) ;
rupture ;
case « C » :
myPort.write('3') ;
Fill(255,0,0) ;
Rect(100,300,100,75,5) ;
rupture ; affaire aurait ":
myPort.write('4') ;
Fill(255,0,0) ;
Rect(250,300,100,75,5) ;
rupture ;
par défaut :
rupture ;
} }
Visitez myblog-mechanic37.com