Arduino Infinity Mirror - 3rd Year (2017)

Arduino Infinity Mirror - 3rd Year (2017)

This was a week long workshop consisting of learning the basics of Arduino, and also completing a basic project.
Our team decided on designing an infinity mirror, that changes color depending on temperature. We also made it energy-saving by adding proximity sensors. Using these meant that the led-strip will only light up when the person is within 1 meter from the mirror.
We used blue as an indicator for cold weather, green for optimum temperature, and red indicating hot weather.
I added in a quick video, explaining and showcasing the project.
Enjoy.


CODE
// color swirl! connect an RGB LED to the PWM pins as indicated
// in the #defines
// public domain, enjoy!
int TempSensor = A0;
int REDPIN = 5;
int GREENPIN = 6;
int BLUEPIN = 3;
int MAXTEMP = 22;
int MINTEMP = 18;
int val;
int tempPin = A0;
int RGB = 0;
 
void setup() {
  Serial.begin(9600);
  pinMode(REDPIN, OUTPUT);
  pinMode(GREENPIN, OUTPUT);
  pinMode(BLUEPIN, OUTPUT);
  pinMode (TempSensor, INPUT);
}
 
 
void loop() {
  val = analogRead(tempPin);
  float mv = (val/1024.0)*5000;
  float cel = mv/10;
  float farh = (cel*9)/5 +32;
  Serial.print("Temperature:");
  Serial.print(cel);
  Serial.print("*C");
  Serial.println();
  delay(500);
int blue (tempPin)
{
  digitalWrite(BLUEPIN, HIGH);
  digitalWrite(GREENPIN, LOW);
  digitalWrite (REDPIN, LOW); 
}
int red (tempPin)
}
  digitalWrite (REDPIN, HIGH);
  digitalWrite(GREENPIN, LOW);
  digitalWrite (BLUEPIN, LOW);
}
int green (tempPin)
}
  digitalWrite (REDPIN, LOW);
  digitalWrite(GREENPIN,HIGH);
  digitalWrite (BLUEPIN, LOW);
}
if (cel<=MINTEMP)//blue
{
  RGB = BLUE (tempPin);
}
else if (cel>=MAXTEMP)//red
{
   RGB = RED (tempPin);
}
else if (cel>MINTEMP|| cel<MAXTEMP)//green
{
  RGB = GREEN (tempPin);
}

}
}
  

Arduino Infinity Mirror - 3rd Year (2017)
Published:

Arduino Infinity Mirror - 3rd Year (2017)

Published: