99 10 kilohm potentiometer
1010
1111 Software required :
12- Processing http://processing.org
13- Active internet connection
12+ Processing (3.0 or newer) http://processing.org
13+ Active internet connection
1414
1515 Created 18 September 2012
1616 by Scott Fitzgerald
@@ -34,71 +34,69 @@ void loop() {
3434}
3535
3636/* Processing code for this example
37- // Tweak the Arduno Logo
38- // by Scott Fitzgerald
39- // This example code is in the public domain
37+ // Tweak the Arduno Logo
38+ // by Scott Fitzgerald
39+ // This example code is in the public domain
4040
41- // import the serial library
42- import processing.serial.*;
41+ // import the serial library
42+ import processing.serial.*;
4343
44- // create an instance of the serial library
45- Serial myPort;
44+ // create an instance of the serial library
45+ Serial myPort;
4646
47- // create an instance of PImage
48- PImage logo;
47+ // create an instance of PImage
48+ PImage logo;
4949
50- // a variable to hold the background color
51- int bgcolor = 0;
50+ // a variable to hold the background color
51+ int bgcolor = 0;
5252
53- void setup() {
54- // set the color mode to Hue/Saturation/Brightness
55- colorMode(HSB, 255);
56-
57- // load the Arduino logo into the PImage instance
58- logo = loadImage("http://www.arduino.cc/en/pub/skins/arduinoWide/img/logo.png");
59-
60- // make the window the same size as the image
61- size(logo.width, logo.height);
62-
63- // print a list of available serial ports to the
64- // Processing staus window
65- println("Available serial ports:");
66- println(Serial.list());
67-
68- // Tell the serial object the information it needs to communicate
69- // with the Arduno. Change Serial.list()[0] to the correct
70- // port corresponding to your Arduino board. The last
71- // parameter (e.g. 9600) is the speed of the communication. It
72- // has to correspond to the value passed to Serial.begin() in your
73- // Arduino sketch.
74- myPort = new Serial(this, Serial.list()[0], 9600);
75-
76- // If you know the name of the port used by the Arduino board, you
77- // can specify it directly like this.
78- // port = new Serial(this, "COM1", 9600);
79-
80- }
81-
82- void draw() {
53+ void setup() {
54+ size(1, 1);
55+ surface.setResizable(true);
56+ // set the color mode to Hue/Saturation/Brightness
57+ colorMode(HSB, 255);
58+
59+ // load the Arduino logo into the PImage instance
60+ logo = loadImage("http://www.arduino.cc/arduino_logo.png");
61+
62+ // make the window the same size as the image
63+ surface.setSize(logo.width, logo.height);
64+
65+ // print a list of available serial ports to the
66+ // Processing staus window
67+ println("Available serial ports:");
68+ println(Serial.list());
69+
70+ // Tell the serial object the information it needs to communicate
71+ // with the Arduno. Change Serial.list()[0] to the correct
72+ // port corresponding to your Arduino board. The last
73+ // parameter (e.g. 9600) is the speed of the communication. It
74+ // has to correspond to the value passed to Serial.begin() in your
75+ // Arduino sketch.
76+ myPort = new Serial(this, Serial.list()[0], 9600);
77+
78+ // If you know the name of the port used by the Arduino board, you
79+ // can specify it directly like this.
80+ // port = new Serial(this, "COM1", 9600);
81+ }
8382
84- // if there is information in the serial port
85- if ( myPort.available() > 0) {
86- // read the value and store it in a variable
87- bgcolor = myPort.read();
83+ void draw() {
8884
89- // print the value to the status window
90- println(bgcolor);
91- }
85+ // if there is information in the serial port
86+ if ( myPort.available() > 0) {
87+ // read the value and store it in a variable
88+ bgcolor = myPort.read();
9289
93- // Draw the background. the variable bgcolor
94- // contains the Hue, determined by the value
95- // from the serial port
96- background(bgcolor, 255, 255);
90+ // print the value to the status window
91+ println(bgcolor);
92+ }
9793
98- // draw the Arduino logo
99- image(logo, 0, 0);
100- }
94+ // Draw the background. the variable bgcolor
95+ // contains the Hue, determined by the value
96+ // from the serial port
97+ background(bgcolor, 255, 255);
10198
99+ // draw the Arduino logo
100+ image(logo, 0, 0);
101+ }
102102 */
103-
104-
0 commit comments