BUBBLES!!!!! What event doesn’t need bubbles?
You can find this bubble machine online for around 30 to 40 dollars. It did a great job of creating bubbles. We did learn that for the best effect you need a bubble solution that is made for bubble machine. The default machine operation pretty much just turned on and it runs until its out of bubble juice. This lasted from around 30 to 40 minutes. Instead of having a stream of bubbles for a period of time and then someone having to constantly refill the bubble machine. I decided to put an interval time on the machine.
I even looked to see if I was to pay a little more would a bubble machine come with an interval timer. They don’t exists. I saw this as another fun opportunity to super power some store bought and make it fit my needs. Just for user interactivity fun I add to the machine a big fat button that a user can press and force the machine to create bubbles.
Here is the code for the arduino.
#include <SimpleTimer.h> #include <Button.h> #include "PotMonitor.h" bool bubblesOn = false; #define bubbleMotorPin 10 #define switchPin 6 #define potPin 3 bool _fanPedalRunMode = false; long minBubbleOnTime = 10000; long maxBubbleOnTime = 45000; long minBubbleOffTime = 10000; long maxBubbleOffTime = 300000; long minUserRunTime = 1000; long offTime = minBubbleOffTime; long onTime = minBubbleOnTime; long runTime = 0; int TIMER_ID = 0; Button footPedal = Button(switchPin, HIGH); SimpleTimer timer; PotMonitor intervalController( potPin); void setBubbleSequenceTime(int value) { //int delay = constrain(value, 20, 254); timer.deleteTimer( TIMER_ID ); offTime = map(value, 0, 1024, minBubbleOffTime, maxBubbleOffTime); //offTime = constrain(offTime, minBubbleOffTime, maxBubbleOffTime); onTime = map( value, 0, 1024, minBubbleOnTime, maxBubbleOnTime ); //onTime = constrain( onTime, minBubbleOnTime, maxBubbleOnTime ); bubblesOn = false; bubbleStateChange(); } void forceRunFan() { if (!_fanPedalRunMode) { bubblesOn = true; timer.deleteTimer( TIMER_ID ); _fanPedalRunMode = true; runTime = millis() + minUserRunTime; digitalWrite( bubbleMotorPin, HIGH); } } void forceStopFan() { if (_fanPedalRunMode) { _fanPedalRunMode = false; digitalWrite( bubbleMotorPin, LOW); bubbleStateChange(); } } void bubbleStateChange() { if ( bubblesOn == true ) { bubblesOn = false; digitalWrite( bubbleMotorPin, LOW); TIMER_ID = timer.setTimeout( offTime, bubbleStateChange ); } else { bubblesOn = true; digitalWrite( bubbleMotorPin, HIGH ); TIMER_ID = timer.setTimeout( onTime, bubbleStateChange ); } delay(100); } void setup() { Serial.begin( 57600 ); Serial.println( "Start up bubblemachine" ); pinMode( bubbleMotorPin, OUTPUT ); bubbleStateChange(); } void loop() { if (intervalController.hasUpdated() == true ) { //Serial.println("update time"); //while ( intervalController.waitForPotTurnComplete() ){ //} setBubbleSequenceTime( intervalController.getValue() ); } timer.run(); // check for footpedaltalk footPedal.listen(); if (footPedal.isPressed() && !_fanPedalRunMode) { forceRunFan(); } else if (!footPedal.isPressed() && _fanPedalRunMode && ( millis() > runTime) ) { forceStopFan(); } delay( 100 ); }