Tuesday, September 27, 2016

Love-o-Meter

Final Set-Up

I had to mess with the base temperature a little bit for the lights to be off at room temperature. It also isn't shown in the video, but I later changed the code a little bit so that each of the lights lights up individually; in the code in this video, the last two lights come on simultaneously.

I changed it to:

  if(temperature < baselineTemp+1) {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  } else if(temperature >= baselineTemp+1 && temperature < baselineTemp+3){
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  } else if(temperature >= baselineTemp+3 && temperature < baselineTemp+5){
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  }else if (temperature >= baselineTemp+5 && temperature < baselineTemp+7) {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
  }


No comments:

Post a Comment