Skip to content

Commit

Permalink
Edited some comments to handle long lines in manuscript-ejg
Browse files Browse the repository at this point in the history
  • Loading branch information
ejgertz committed Dec 9, 2011
1 parent 4b707b5 commit 8f2b8fd
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions chapter-2/NoiseMonitor
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ int counter =0;
int threshold[] = { 0, 47, 99, 159, 227, 308, 407, 535, 715, 800, 900}; int threshold[] = { 0, 47, 99, 159, 227, 308, 407, 535, 715, 800, 900};




// You can play with the sensitivity of the LEDs by removing the above threshold and using // You can play with the sensitivity of the LEDs by removing the above threshold
// the one below. Try different values. Experiment! // and using the one below. Try different values. Experiment!
//int threshold[]={ 0, 25, 50, 75, 100, 125, 150, 175, 200, 225}; //int threshold[]={ 0, 25, 50, 75, 100, 125, 150, 175, 200, 225};




void setup() void setup()
{ {
// declare the ledPins as an OUTPUT. We're doing it line-by-line, so you can see what's happening. // declare the ledPins as an OUTPUT.
// We're doing it line-by-line, so you can see what's happening.
pinMode(2, OUTPUT); pinMode(2, OUTPUT);
pinMode(3, OUTPUT); pinMode(3, OUTPUT);
pinMode(4, OUTPUT); pinMode(4, OUTPUT);
Expand Down Expand Up @@ -63,8 +64,10 @@ void setup()
} }




// Tests the LEDs by turning them on. This time, we're using a for() loop to do the job. // Tests the LEDs by turning them on.
// Using for(), while() and other loops is probably how you should handle tasks like this. // This time, we're using a for() loop to do the job.
// Using for(), while() and other loops is probably
// how you should handle tasks like this.
for(int i=0; i <=numberOfLEDs; i++) for(int i=0; i <=numberOfLEDs; i++)
{ {
digitalWrite(i+1, HIGH); digitalWrite(i+1, HIGH);
Expand Down Expand Up @@ -94,9 +97,9 @@ void loop()
// adding that to the running total, and taking the average. // adding that to the running total, and taking the average.
// This gives us a "typical" sound sample. // This gives us a "typical" sound sample.


// Here we increase our counter, to keep track of how many audio samples // Here we increase our counter, to keep track of how many
// we are taking. If we use more than the number of samples, // audio samples we're taking. If we use more than the number
// use the % (modulo) operator to set the counter to zero. // of samples, use the % (modulo) operator to set the counter to zero.


counter = ++counter % numberOfSamples; counter = ++counter % numberOfSamples;


Expand Down Expand Up @@ -138,6 +141,4 @@ void loop()
{ {
digitalWrite(i+1, LOW); digitalWrite(i+1, LOW);
} }
} }


0 comments on commit 8f2b8fd

Please sign in to comment.