File tree Expand file tree Collapse file tree 9 files changed +24
-19
lines changed
08.Strings/CharacterAnalysis Expand file tree Collapse file tree 9 files changed +24
-19
lines changed Original file line number Diff line number Diff line change 99 * 8-ohm speaker on digital pin 8
1010
1111 created 21 Jan 2010
12- modified 30 Aug 2011
12+ modified 9 Apr 2012
1313 by Tom Igoe
1414
1515This example code is in the public domain.
@@ -41,5 +41,4 @@ void loop() {
4141 tone (8 , notes[thisSensor], 20 );
4242 }
4343 }
44- Serial.println ();
4544}
Original file line number Diff line number Diff line change 99 * 4.7K resistor on analog 0 to ground
1010
1111 created 21 Jan 2010
12- modified 30 Aug 2011
12+ modified 9 Apr 2012
1313 by Tom Igoe
1414
1515This example code is in the public domain.
@@ -36,7 +36,7 @@ void loop() {
3636
3737 // play the pitch:
3838 tone (9 , thisPitch, 10 );
39-
39+ delay ( 1 ); // delay in between reads for stability
4040}
4141
4242
Original file line number Diff line number Diff line change 1212 * LED connected from digital pin 9 to ground
1313
1414 created 29 Dec. 2008
15- modified 30 Aug 2011
15+ modified 9 Apr 2012
1616 by Tom Igoe
1717
1818 This example code is in the public domain.
@@ -46,8 +46,8 @@ void loop() {
4646 Serial.print (" \t output = " );
4747 Serial.println (outputValue);
4848
49- // wait 10 milliseconds before the next loop
49+ // wait 2 milliseconds before the next loop
5050 // for the analog-to-digital converter to settle
5151 // after the last reading:
52- delay (10 );
52+ delay (2 );
5353}
Original file line number Diff line number Diff line change 1010 * Analog sensor (potentiometer will do) attached to analog input 0
1111
1212 Created 22 April 2007
13- modified 30 Aug 2011
1413 By David A. Mellis <dam@mellis.org>
15-
14+ modified 9 Apr 2012
15+ by Tom Igoe
1616 http://www.arduino.cc/en/Tutorial/Smoothing
1717
1818 This example code is in the public domain.
@@ -61,7 +61,8 @@ void loop() {
6161 // calculate the average:
6262 average = total / numReadings;
6363 // 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
6566}
6667
6768
Original file line number Diff line number Diff line change 1818
1919 created 2006
2020 by David A. Mellis
21- modified 30 Aug 2011
21+ modified 9 Apr 2012
2222 by Tom Igoe and Scott Fitzgerald
2323
2424 This example code is in the public domain.
@@ -36,7 +36,7 @@ void loop() {
3636 Serial.println (analogRead (A0));
3737 // wait a bit for the analog-to-digital converter
3838 // to stabilize after the last reading:
39- delay (10 );
39+ delay (2 );
4040}
4141
4242/* Processing code for this example
Original file line number Diff line number Diff line change 1515
1616 Created 26 Sept. 2005
1717 by Tom Igoe
18- modified 30 Aug 2011
18+ modified 9 Apr 2012
1919 by Tom Igoe and Scott Fitzgerald
2020
2121 This example code is in the public domain.
@@ -33,6 +33,10 @@ void setup()
3333{
3434 // start serial port at 9600 bps:
3535 Serial.begin (9600 );
36+ while (!Serial) {
37+ ; // wait for serial port to connect. Needed for Leonardo only
38+ }
39+
3640 pinMode (2 , INPUT); // digital sensor is on digital pin 2
3741 establishContact (); // send a byte to establish contact until receiver responds
3842}
Original file line number Diff line number Diff line change 1616 connected to pin 13, so you don't need any extra components for this example.
1717
1818 created 17 Jan 2009
19- modified 30 Aug 2011
19+ modified 9 Apr 2012
2020 by Tom Igoe
2121
2222This example code is in the public domain.
@@ -51,6 +51,6 @@ void loop() {
5151
5252 // print the analog value:
5353 Serial.println (analogValue);
54-
54+ delay ( 1 ); // delay in between reads for stability
5555}
5656
Original file line number Diff line number Diff line change 1414 * 10K resistor from analog in 0 to ground
1515
1616 created 1 Jul 2009
17- modified 30 Aug 2011
17+ modified 9 Apr 2012
1818 by Tom Igoe
1919
2020 This example code is in the public domain.
2121
2222 http://www.arduino.cc/en/Tutorial/SwitchCase
2323 */
2424
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:
2627const int sensorMin = 0 ; // sensor minimum, discovered through experiment
2728const int sensorMax = 600 ; // sensor maximum, discovered through experiment
2829
@@ -53,7 +54,7 @@ void loop() {
5354 Serial.println (" bright" );
5455 break ;
5556 }
56-
57+ delay ( 1 ); // delay in between reads for stability
5758}
5859
5960
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ void setup() {
1515 // Open serial communications and wait for port to open:
1616 Serial.begin (9600 );
1717 while (!Serial) {
18- ; // wait for serial port to connect. Needed fo Leonardo only
18+ ; // wait for serial port to connect. Needed for Leonardo only
1919 }
2020
2121 // send an intro:
You can’t perform that action at this time.
0 commit comments