Skip to content

Commit

Permalink
Changed cap sensors of loudspeaker to Adafruit Standalone 5-Pad Capac…
Browse files Browse the repository at this point in the history
…itive Touch Sensor Breakout - AT42QT1070. New implementation using the digital input pins.
  • Loading branch information
mnemonia committed Nov 23, 2014
1 parent 9208a0c commit bcb894c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Binary file modified Findling/WorkWithSoundAndLight/WorkWithSoundAndLight.cip
Binary file not shown.
34 changes: 32 additions & 2 deletions Findling/WorkWithSoundAndLight/WorkWithSoundAndLight.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Adafruit_CAP1188 cap = Adafruit_CAP1188();
#define SOUND_ON_STANDARD_VALUE 50
#define SOUND_OFF_STANDARD_VALUE 0
#define SOUND_MAX_VALUE 63
#define SOUND_DIM_DELAY 50
#define SOUND_DIM_DELAY 80
#define SOUND_ON_OFF_DELAY 1000
#define SOUND_DIM_STEP 2

Expand All @@ -41,6 +41,9 @@ int ambientDimValue = LIGHT_OFF_STANDARD_VALUE;

#define LIGHT_PIN 6
#define AMBIENT_PIN 5
#define LOUDSPEAKER_ONOFF_PIN 4
#define LOUDSPEAKER_PLUS_PIN 3
#define LOUDSPEAKER_MINUS_PIN 2

void setup() {
Serial.begin(9600);
Expand All @@ -49,11 +52,17 @@ void setup() {

setupCapSensor();
setupAmplifier();
setupLoudspeakerSensor();
setupLight();
setupStateMachines();
Serial.println("Starting Findl.ing WorkWithSoundAndLight Controller DONE");

}
void setupLoudspeakerSensor(){
pinMode(LOUDSPEAKER_ONOFF_PIN, INPUT);
pinMode(LOUDSPEAKER_PLUS_PIN, INPUT);
pinMode(LOUDSPEAKER_MINUS_PIN, INPUT);
}

void setupAmplifier(){
if (! setvolume(SOUND_OFF_STANDARD_VALUE)) {
Expand Down Expand Up @@ -109,7 +118,8 @@ void setupStateMachines(){

void loop() {
checkAndSetLightControls();
checkAndSetAudioControls();
//checkAndSetAudioControls();
checkAndSetLoundspeakerControls();
checkAndSetAmbientControls();
delay(25);
}
Expand Down Expand Up @@ -166,6 +176,26 @@ void checkAndSetAudioControls(){
}
}

void checkAndSetLoundspeakerControls(){
int touched = digitalRead(LOUDSPEAKER_ONOFF_PIN);
if (touched == LOW) {
Serial.println("Loudspeaker Sense ON/OFF");
IN_.SoundSwitchIn(C6_TOGGLE);
}else{
touched = digitalRead(LOUDSPEAKER_MINUS_PIN);
if (touched == LOW) {
Serial.println("Loudspeaker Sense Minus");
IN_.SoundLoudnessIn(C8_MINUS);
}else{
touched = digitalRead(LOUDSPEAKER_PLUS_PIN);
if (touched == LOW) {
Serial.println("Loudspeaker Sense Minus");
IN_.SoundLoudnessIn(C8_PLUS);
}
}
}
}

void incBrightness(){
lightDimValue += LIGHT_DIM_STEP;
if(lightDimValue >= 255){
Expand Down

0 comments on commit bcb894c

Please sign in to comment.