Very first Arduino + breadboard project [Temperature sensor + RGB LED + Buzzer]

Let me introduce myself to the community, my name is Josh and I am a senior in highschool. I've always had a thing for electronics but never understood how it all worked so I signed up for electronic basics class. We go over all the components and what not, and we solder a lot. I got an Arduino Uno on Christmas, and never really touched it until now because I had no clue how to use it.

This is my very first project with Arduino, using what came with the basic starter kit. It's a very simple project, but I still feel accomplished. You gotta start somewhere.

All it does is read the temperature using a TMP36 sensor and using a set of intervals I have it light up a RGB LED (Triple color). Red is >= 80 Fahrenheit, Green is 70 Fahrenheit >= and <= 80 Fahrenheit, and Blue is <= 70 Fahrenheit. When it gets above 80 Fahrenheit it'll change to red and blink, and so on...

I didn't really need to draw a schematic because it was very basic to set up. I have four components, and 8 wires. Anyway, here's a picture of the set up. No video this time, I don't think I need one..

20141002_030756.jpg

jLid:
It's a very simple project, but I still feel accomplished. You gotta start somewhere.

Well done and thanks for the share.

Nice job Josh. And you did this all by yourself without posting for help ? Very impressive.

Well i've been on other forums for many years and if there's one thing I learned, is that all you have to do is search and it'll be there. Even if you don't think there will be anything, chances are there is. I only really ask for help unless I am completely stumped on something which, otherwise i'll do some research. Here's my code if you guys think I could improve on anything:

int outputPin= 0; //Analog pin # for temperature sensor.
int minPin = 12; //Pin # for minimum temperature LED.
int normalPin = 8; //Pin # for normal temperature LED.
int maxPin = 10; //Pin # for the maximum temperature LED.
int minTemp = 70; //Minumum temperature.
int maxTemp = 80; //Maximum temperature. 


void beep(unsigned char delayms) {
  analogWrite(5, 1500);  //Almost any value except {0,255}. Changes the tone.           
  delay(delayms);  //Delay by # milliseconds.
  analogWrite(5, 0);  //0 shuts it off.
  delay(delayms);  //Delay by # milliseconds.
}  

void setup() {  //Sets the GND pin to LOW and the (+) pin to HIGH
  Serial.begin(9600);
  pinMode(5, OUTPUT);
}

void loop() {
int rawVoltage= analogRead(outputPin);
float volts= rawVoltage/205.0;
float celsiusTemp= 100.0 * volts - 50;
float fahrenheitTemp= celsiusTemp * 9.0/5.0 + 32.0;
if((fahrenheitTemp) >= maxTemp) {  //If temperature is higher than or equal to the maximum temperature...
  digitalWrite(normalPin, LOW); digitalWrite(minPin, LOW);  //Turn normalPin and minPin LED off.
  digitalWrite(maxPin, HIGH);  //Turn maxPin LED on.
  beep(555); //Output tone to speaker.
    beep(555); //Output tone to speaker.
  beep(555); //Output tone to speaker.
  beep(555); //Output tone to speaker.
  beep(555); //Output tone to speaker.

} else if((fahrenheitTemp) <= maxTemp && (fahrenheitTemp) >= minTemp) {  //If the temperature is between or equal to the maximum/minimum temperature...
  digitalWrite(minPin, LOW); digitalWrite(maxPin, LOW);  //Turn minPin and maxPin LED off.
  digitalWrite(normalPin, HIGH);  //Turn normalPin LED on.
    beep(222); //Output tone to speaker.
  beep(222); //Output tone to speaker.
  beep(222); //Output tone to speaker.
} else if((fahrenheitTemp) <= minTemp) {  //If the temperature is less than or equal to the minimum temperature...
  digitalWrite(normalPin, LOW); digitalWrite(maxPin, LOW); //Turn normalPin and maxPin LED off.
  digitalWrite(minPin, HIGH); //Turn minPin LED on.
    beep(444); //Output tone to speaker.
    beep(444); //Output tone to speaker.
    beep(444); //Output tone to speaker.
}
Serial.print(fahrenheitTemp);  //Display Farheinheit temperature in console box.
Serial.println(" Fahrenheit");  
delay(2500);
}

I did look at a few example snippets to help me, but the code is self explanatory.

Well i've been on other forums for many years and if there's one thing I learned, is that all you have to do is search and it'll be there. Even if you don't think there will be anything, chances are there is.

I'm sure I speak for everyone on the forum when I say we wish all Newbies knew this. XD