Back to Parent

// Code for balloon inflation based on mic input


int val = 0;
int count1 = 1;
float percent = 0;
int micAnalog = A0;//Declare a variable for the soil moisture sensor
int micDigital = D0;

int servoPin = A4;
Servo balloon;
int servoPos = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(micAnalog, INPUT);
  pinMode(micDigital, INPUT);
  balloon.attach( servoPin );
  //digitalWrite();

}

void loop()
{
  val = analogRead(micAnalog);
  if(val > 2900)
  {

    balloon.write( 120 );
    delay(10000);
    
  } else {
    balloon.write( 30 );
    delay(5000);

  }
  //Serial.println(val);

}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0