File tree 9 files changed +24
-19
lines changed
08.Strings/CharacterAnalysis
9 files changed +24
-19
lines changed Original file line number Diff line number Diff line change 9
9
* 8-ohm speaker on digital pin 8
10
10
11
11
created 21 Jan 2010
12
- modified 30 Aug 2011
12
+ modified 9 Apr 2012
13
13
by Tom Igoe
14
14
15
15
This example code is in the public domain.
@@ -41,5 +41,4 @@ void loop() {
41
41
tone (8 , notes[thisSensor], 20 );
42
42
}
43
43
}
44
- Serial.println ();
45
44
}
Original file line number Diff line number Diff line change 9
9
* 4.7K resistor on analog 0 to ground
10
10
11
11
created 21 Jan 2010
12
- modified 30 Aug 2011
12
+ modified 9 Apr 2012
13
13
by Tom Igoe
14
14
15
15
This example code is in the public domain.
@@ -36,7 +36,7 @@ void loop() {
36
36
37
37
// play the pitch:
38
38
tone (9 , thisPitch, 10 );
39
-
39
+ delay ( 1 ); // delay in between reads for stability
40
40
}
41
41
42
42
Original file line number Diff line number Diff line change 12
12
* LED connected from digital pin 9 to ground
13
13
14
14
created 29 Dec. 2008
15
- modified 30 Aug 2011
15
+ modified 9 Apr 2012
16
16
by Tom Igoe
17
17
18
18
This example code is in the public domain.
@@ -46,8 +46,8 @@ void loop() {
46
46
Serial.print (" \t output = " );
47
47
Serial.println (outputValue);
48
48
49
- // wait 10 milliseconds before the next loop
49
+ // wait 2 milliseconds before the next loop
50
50
// for the analog-to-digital converter to settle
51
51
// after the last reading:
52
- delay (10 );
52
+ delay (2 );
53
53
}
Original file line number Diff line number Diff line change 10
10
* Analog sensor (potentiometer will do) attached to analog input 0
11
11
12
12
Created 22 April 2007
13
- modified 30 Aug 2011
14
13
By David A. Mellis <[email protected] >
15
-
14
+ modified 9 Apr 2012
15
+ by Tom Igoe
16
16
http://www.arduino.cc/en/Tutorial/Smoothing
17
17
18
18
This example code is in the public domain.
@@ -61,7 +61,8 @@ void loop() {
61
61
// calculate the average:
62
62
average = total / numReadings;
63
63
// send it to the computer as ASCII digits
64
- Serial.println (average);
64
+ Serial.println (average);
65
+ delay (1 ); // delay in between reads for stability
65
66
}
66
67
67
68
Original file line number Diff line number Diff line change 18
18
19
19
created 2006
20
20
by David A. Mellis
21
- modified 30 Aug 2011
21
+ modified 9 Apr 2012
22
22
by Tom Igoe and Scott Fitzgerald
23
23
24
24
This example code is in the public domain.
@@ -36,7 +36,7 @@ void loop() {
36
36
Serial.println (analogRead (A0));
37
37
// wait a bit for the analog-to-digital converter
38
38
// to stabilize after the last reading:
39
- delay (10 );
39
+ delay (2 );
40
40
}
41
41
42
42
/* Processing code for this example
Original file line number Diff line number Diff line change 15
15
16
16
Created 26 Sept. 2005
17
17
by Tom Igoe
18
- modified 30 Aug 2011
18
+ modified 9 Apr 2012
19
19
by Tom Igoe and Scott Fitzgerald
20
20
21
21
This example code is in the public domain.
@@ -33,6 +33,10 @@ void setup()
33
33
{
34
34
// start serial port at 9600 bps:
35
35
Serial.begin (9600 );
36
+ while (!Serial) {
37
+ ; // wait for serial port to connect. Needed for Leonardo only
38
+ }
39
+
36
40
pinMode (2 , INPUT); // digital sensor is on digital pin 2
37
41
establishContact (); // send a byte to establish contact until receiver responds
38
42
}
Original file line number Diff line number Diff line change 16
16
connected to pin 13, so you don't need any extra components for this example.
17
17
18
18
created 17 Jan 2009
19
- modified 30 Aug 2011
19
+ modified 9 Apr 2012
20
20
by Tom Igoe
21
21
22
22
This example code is in the public domain.
@@ -51,6 +51,6 @@ void loop() {
51
51
52
52
// print the analog value:
53
53
Serial.println (analogValue);
54
-
54
+ delay ( 1 ); // delay in between reads for stability
55
55
}
56
56
Original file line number Diff line number Diff line change 14
14
* 10K resistor from analog in 0 to ground
15
15
16
16
created 1 Jul 2009
17
- modified 30 Aug 2011
17
+ modified 9 Apr 2012
18
18
by Tom Igoe
19
19
20
20
This example code is in the public domain.
21
21
22
22
http://www.arduino.cc/en/Tutorial/SwitchCase
23
23
*/
24
24
25
- // these constants won't change:
25
+ // these constants won't change. They are the
26
+ // lowest and highest readings you get from your sensor:
26
27
const int sensorMin = 0 ; // sensor minimum, discovered through experiment
27
28
const int sensorMax = 600 ; // sensor maximum, discovered through experiment
28
29
@@ -53,7 +54,7 @@ void loop() {
53
54
Serial.println (" bright" );
54
55
break ;
55
56
}
56
-
57
+ delay ( 1 ); // delay in between reads for stability
57
58
}
58
59
59
60
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ void setup() {
15
15
// Open serial communications and wait for port to open:
16
16
Serial.begin (9600 );
17
17
while (!Serial) {
18
- ; // wait for serial port to connect. Needed fo Leonardo only
18
+ ; // wait for serial port to connect. Needed for Leonardo only
19
19
}
20
20
21
21
// send an intro:
You can’t perform that action at this time.
0 commit comments