Skip to content

Commit 3a32545

Browse files
committed
I was hoping to make a decaying bell tone by adjusting tone() PWM but this seems like a handful if doable at all, so come back to it later
1 parent 6371018 commit 3a32545

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

sixtube_lm/sixtube_lm.ino

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ void loop(){
189189
checkRTC(false); //if clock has ticked, decrement timer if running, and updateDisplay
190190
checkInputs(); //if inputs have changed, this will do things + updateDisplay as needed
191191
doSetHold(); //if inputs have been held, this will do more things + updateDisplay as needed
192+
//cycleBellTone(); //if beeper is making a bell tone noise, continue to "animate" its decay TODO
192193
}
193194
//Things done every loop cycle
194195
cycleDisplay(); //keeps the display hardware multiplexing cycle going
@@ -745,6 +746,21 @@ void getHz(byte note){
745746
//56 = 659.2 E5
746747
//61 = 880 A5
747748
}
749+
//Sometimes we activate the beeper directly (e.g. pips) but most of the time we make a bell tone TODO
750+
// char curBellToneLevel; //support negative just in case
751+
// word curBellTonePitch;
752+
// void cycleBellTone(){
753+
// //Called by loop() 50ms polling – make bell tone decay
754+
// //An Arduino pin directly to a piezo element/buzzer is not very good. The piezo is like a capacitor and you need a resistor of 100 ohm to reduce the peak currents.
755+
// if(curBellToneLevel > 0) {
756+
// curBellToneLevel *= 0.9; //decay by 1/10 each time
757+
// if(curBellToneLevel<=0) {
758+
// currBelToneLevel = 0; //TODO stop tone fully
759+
// } else {
760+
// //TODO make the bell this level - whatever it was doing before
761+
// }
762+
// }
763+
// }
748764

749765
////////// Display data formatting //////////
750766
void updateDisplay(){

0 commit comments

Comments
 (0)