Back to Parent

int LG=A4; //variable to hold light sensor value
 double TP=A7; // variable to hold temperature sensor value
 int GREEN=A0; // location for the green led
 int RED=D0; // location of red led

 int lt=0; // declaring cloud variable for light
double tt=0.0; // declaring cloud variable for temperature

  void setup()
{
  pinMode (LG,INPUT); // light sensor is input
  pinMode (TP,INPUT); // temperature sensor is input
  pinMode (GREEN,OUTPUT); // greenled is output
  pinMode (RED,OUTPUT); // redled is output

  Spark.variable("lt", &lt, INT); // allowing cloud read light
  Spark.variable("tt", &tt, DOUBLE); // allowing cloud read temperature
}

 void loop()
{
tt = analogRead (TP);  // get temperature sensor Reading / check water temperature
if (212 < TP < 4000)  // if above 212 Fahrenheit
{
digitalWrite(GREEN, HIGH); // used basic HelloWorld to blink green LED
delay(1000);
digitalWrite(GREEN, LOW);
delay(1000);
}else{
digitalWrite(GREEN, LOW); // LED off
}
lt = analogRead (LG);  // get light sensor Reading / check if there's light coming in
if (50 < LG < 4000)  // if theres light
{
digitalWrite(RED, HIGH); // used basic HelloWorld to blink red LED
delay(500);
digitalWrite(RED, LOW);
delay(500);
}else{
digitalWrite(RED, LOW); // LED off
}
delay (1000);  // wait 5 seconds
}
// loop
Click to Expand

Content Rating

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

0