@@ -40,7 +40,7 @@ void setup() {
4040 digitalWrite (NEOPIXEL_POWER, LOW); // on
4141
4242 display.begin (THINKINK_MONO);
43-
43+
4444 if (! lis.begin (0x19 )) {
4545 Serial.println (" Couldnt start LIS3DH" );
4646 display.clearBuffer ();
@@ -81,7 +81,7 @@ void loop() {
8181 if (j % 10 == 0 ) {
8282 sensors_event_t event;
8383 lis.getEvent (&event);
84-
84+
8585 /* Display the results (acceleration is measured in m/s^2) */
8686 Serial.print (" X: " ); Serial.print (event.acceleration .x );
8787 Serial.print (" \t Y: " ); Serial.print (event.acceleration .y );
@@ -99,11 +99,11 @@ void loop() {
9999 if ((abs (event.acceleration .x ) < 5 ) && (event.acceleration .y < -5 )) {
100100 rotation = 2 ;
101101 }
102-
102+
103103 int light = analogRead (LIGHT_SENSOR);
104104 Serial.print (" Light sensor: " );
105105 Serial.println (light);
106-
106+
107107 Serial.print (" I2C scanner: " );
108108 for (int i = 0x07 ; i <= 0x77 ; i++) {
109109 Wire.beginTransmission (i);
@@ -118,12 +118,12 @@ void loop() {
118118 if (! digitalRead (BUTTON_A)) {
119119 Serial.println (" Button A pressed" );
120120 intneo.fill (0xFF0000 );
121- intneo.show ();
121+ intneo.show ();
122122 }
123123 else if (! digitalRead (BUTTON_B)) {
124124 Serial.println (" Button B pressed" );
125125 intneo.fill (0x00FF00 );
126- intneo.show ();
126+ intneo.show ();
127127 }
128128 else if (! digitalRead (BUTTON_C)) {
129129 Serial.println (" Button C pressed" );
@@ -142,7 +142,7 @@ void loop() {
142142 for (int i = 0 ; i < intneo.numPixels (); i++) {
143143 intneo.setPixelColor (i, Wheel (((i * 256 / intneo.numPixels ()) + j) & 255 ));
144144 }
145- intneo.show ();
145+ intneo.show ();
146146 }
147147
148148 // Red LED off
@@ -155,7 +155,8 @@ void loop() {
155155void play_tune (const uint8_t *audio, uint32_t audio_length) {
156156 uint32_t t;
157157 uint32_t prior, usec = 1000000L / SAMPLE_RATE;
158-
158+
159+ prior = micros ();
159160 for (uint32_t i=0 ; i<audio_length; i++) {
160161 while ((t = micros ()) - prior < usec);
161162 dacWrite (A0, audio[i]);
0 commit comments