Chapter 11 – Experiment 04 – TEMPERATURE SENSOR

int pin = 0; // analog pin
int tempc = 0; // temperature variables
int samples[8]; // variables to make a better precision
int i;

void setup()
{
for (i=2; i<8; i++) {
pinMode(i, OUTPUT);
}
}

void loop()
{
for(i=0; i<=7; i++){ // gets 8 samples of temperature
samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
tempc = tempc + samples[i];
delay(100);
}

tempc = tempc/8.0; // better precision

// fiki te gjitha llambushkat
for (i=2; i<10; i++) {
digitalWrite(2, HIGH);
}

if (tempc > 20) {
digitalWrite(3, HIGH);
}
if (tempc > 30) {
digitalWrite(4, HIGH);
}
if (tempc > 40) {
digitalWrite(5, HIGH);
}
if (tempc > 50) {
digitalWrite(6, HIGH);
}
if (tempc > 60) {
digitalWrite(7, HIGH);
}
delay(1000); // delay before loop
}

4 comments

  1. [...] LED Chapter 09 – Experiment 02 – TRAFFIC LIGHTS Chapter 10 – Experiment 03 – LIGHT SENSOR Chapter 11 – Experiment 04 – TEMPERATURE SENSOR Chapter 12 – Experiment 05 – PUSHBUTTON Chapter 13 – Experiment 06 – INTEGRATED [...]

  2. nt pin = 0; // analog pin
    int tempc = 0; // temperature variables
    int samples[8]; // variables to make a better precision
    int i;

    void setup()
    {
    for (i=2; i<8; i++) {
    pinMode(i, OUTPUT);
    }
    }

    void loop()
    {
    for(i=0; i<=7; i++){ // gets 8 samples of temperature
    samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
    tempc = tempc + samples[i];
    delay(100);
    }

    tempc = tempc/8.0; // better precision

    // fiki te gjitha llambushkat
    for (i=2; i 10) {
    digitalWrite(2, HIGH);
    }
    if (tempc > 20) {
    digitalWrite(3, HIGH);
    }
    if (tempc > 30) {
    digitalWrite(4, HIGH);
    }
    if (tempc > 40) {
    digitalWrite(5, HIGH);
    }
    if (tempc > 50) {
    digitalWrite(6, HIGH);
    }
    if (tempc > 60) {
    digitalWrite(7, HIGH);
    }
    delay(1000); // delay before loop
    }

  3. [...] the breadboard and schema is possible to use the ones on experiment 04, experiment 20 and experiment [...]

  4. Hi there, its good piece of writing on the topic
    of media print, we all know media is a fantastic source of facts.

Leave a Reply to WE MAKE IT – The Manual | WE MAKE IT Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


istanbul evden eve nakliyat istanbul evden eve nakliyat istanbul evden eve nakliyat sarıyer evden eve nakliyat beylikdüzü evden eve nakliyat şişli evden eve nakliyat