Advertisement
gilmaster63

Project 14: Tweak the Arduino Logo (Processing)

Oct 21st, 2013
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import processing.serial.*;
  2. Serial myPort;
  3.  
  4. PImage logo;
  5.  
  6. int bgcolor = 0;
  7.  
  8. void setup() {
  9.   colorMode(HSB, 255);
  10.  
  11.   logo = loadImage("http://arduino.cc/logo.png");
  12.   size(logo.width, logo.height);
  13.  
  14.   println("Available serial ports:");
  15.   println(Serial.list());
  16.  
  17.   myPort = new Serial(this, Serial.list()[5], 9600);
  18. }
  19.  
  20. void draw() {
  21.   if(myPort.available() > 0) {
  22.     bgcolor = myPort.read();
  23.     println(bgcolor);
  24.   }
  25.   background(bgcolor, 255, 255);
  26.   image(logo, 0, 0);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement