@@ -398,7 +398,7 @@ void setup() {
398398 voiceGain (gain);
399399 currentPitch = voicePitch (currentPitch);
400400 if (waveform) voiceMod (modulate, waveform);
401- digitalWrite ( 20 , HIGH); // Speaker on
401+ arcada. enableSpeaker ( true );
402402 }
403403 }
404404#endif
@@ -417,15 +417,7 @@ void setup() {
417417 lastLightReadTime = micros () + 2000000 ; // Delay initial light reading
418418}
419419
420- static inline uint16_t readLightSensor (void ) {
421- #if NUM_EYES > 1
422- if (lightSensorPin >= 100 ) {
423- return arcada.ss .analogRead (lightSensorPin - 100 );
424- }
425- #else
426- return analogRead (lightSensorPin);
427- #endif
428- }
420+
429421
430422// LOOP FUNCTION - CALLED REPEATEDLY UNTIL POWER-OFF -----------------------
431423
@@ -860,7 +852,7 @@ void loop() {
860852 // pupils will react even if the opposite eye is stimulated.
861853 // Meaning we can get away with using a single light sensor for
862854 // both eyes. This comment has nothing to do with the code.
863- uint16_t rawReading = readLightSensor ();
855+ uint16_t rawReading = arcada. readLightSensor ();
864856 if (rawReading <= 1023 ) {
865857 if (rawReading < lightSensorMin) rawReading = lightSensorMin; // Clamp light sensor range
866858 else if (rawReading > lightSensorMax) rawReading = lightSensorMax; // to within usable range
@@ -902,10 +894,10 @@ void loop() {
902894#if defined(ADAFRUIT_MONSTER_M4SK_EXPRESS)
903895 if (voiceOn) {
904896 // Read buttons, change pitch
905- uint32_t buttonState = arcada.ss . digitalReadBulk ( 0b111000000000 ); // Bits CLEAR if currently pressed
906- uint32_t changedState = ~(buttonState ^ priorButtonState); // Bits CLEAR if changed from before
907- uint32_t newlyPressed = ~( buttonState | changedState) ; // Bits SET if newly pressed
908- if ( newlyPressed & 0b001000000000 ) { // Seesaw pin 9 (inner)
897+ uint32_t buttonState = arcada.readButtons ( ); // Bits SET if currently pressed
898+ uint32_t changedState = ~(buttonState ^ priorButtonState); // Bits SET if changed from before
899+ uint32_t newlyPressed = buttonState | changedState; // Bits SET if newly pressed
900+ if ( newlyPressed & ARCADA_BUTTONMASK_UP ) { // Seesaw pin 9 (inner)
909901 currentPitch *= 1.05 ;
910902 } else if (newlyPressed & ARCADA_BUTTONMASK_A) { // Seesaw pin 10 (middle)
911903 currentPitch = defaultPitch;
0 commit comments