Beer foam remover

alex_gaysinsky's picture

 

DESCRIPTION
You finally got your beer but foam is stopping you. Luckily, automatic foam remover starts a little propeller mounted on
top of your glass. You can continue speaking with your friends while foam remover fights the foam
 
PARTS
Arudino
FSR
MOTOR
+ diods, transistors, resistors and wires
 
CODE
/*
 * preusure of beer in the glass starts the motor motor
 */
 
int fsrPin = 0;   // select the input pin for the fsr
int motorPin = 9; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
int smoother = 0;   // adds delay between motor adjustments.
 
void setup() {
  Serial.begin(9600);
}
 
void loop() {
  val = analogRead(fsrPin);    // read the value from the sensor, between 0 - 1024
  if (smoother>0) {
    smoother--;
    return;
  }
  
  if (val > 250){
      analogWrite(motorPin, 500); // analogWrite can be between 0-
      smoother = 5000;
  }
  
  if (val < 100) {
      analogWrite(motorPin, 0); // analogWrite can be between 0-
      smoother = 5000;
  }
}
 
lab
foam remover
0
Your rating: None