Skip to content

Commit 0a92710

Browse files
committed
Merge pull request #2 from arduino/master
pull master
2 parents 4af50d8 + 5067370 commit 0a92710

File tree

3 files changed

+371
-217
lines changed

3 files changed

+371
-217
lines changed

examples/01.Basics/Fade/Fade.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
This example shows how to fade an LED on pin 9
55
using the analogWrite() function.
66
7+
The analogWrite() function uses PWM, so if
8+
you want to change the pin you're using, be
9+
sure to use another PWM capable pin. On most
10+
Arduino, the PWM pins are identified with
11+
a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
12+
713
This example code is in the public domain.
814
*/
915

10-
int led = 9; // the pin that the LED is attached to
16+
int led = 9; // the PWM pin the LED is attached to
1117
int brightness = 0; // how bright the LED is
1218
int fadeAmount = 5; // how many points to fade the LED by
1319

@@ -32,4 +38,3 @@ void loop() {
3238
// wait for 30 milliseconds to see the dimming effect
3339
delay(30);
3440
}
35-

examples/10.StarterKit_BasicKit/p14_TweakTheArduinoLogo/p14_TweakTheArduinoLogo.ino

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy