13 June 2010

Task 55 - Datalogging to an Array: Serial Monitor, software

The usual output: room temperature & my rather warmer fingers for the second (reset) group of values..
..had to re-arrange the software a bit, as the Comments in the software mention..



/*
* Project: DataLogging_Thermistor_task_55_v2
* Author: Jane-Maree Howard
* Date: Sunday 13/06/2010

* Platform: Arduino 18

* Purpose: To data-log 10 successive readings from a thermistor at 1-second intervals, save the readings into an array called mySamples[] & output results to the SM after the last reading.
* Operation: The average resistance of the thermistor is about 10 kOhms,
so it & the 10k resistor form a voltage divider, whose junction is inputted to Analog 0.
* Description:

* Connect one end of the thermistor to 5V, the other end to Analog 0.

Then connect one end of a 10K resistor from Analog 0 to ground.
This is quite similar to the photocell Task, but the software is a little different.
* Comment: I tried messing about with Functions - then after several abortive
attempts, decided to stick to the KISS priciple..


NOTE: this blogger doesn't like 'less-than' signs - it thinks they're HTML
thingies.. so where you see n"10 put n 'less-than' 10
(sigh)
*/


int thermistorPin = 0;
// the thermistor and 10K pulldown are connected to a0

int mySamples[10];
// this array will hold the analog readings from the sensor divider

byte readCount = 10;
// this counts the readings to allow halting..


void setup(void)

{

// We'll send debugging information via the Serial monitor

Serial.begin(9600); // baud rate 9600 should be set on the SM

Serial.println(); // skip a line to start with

//first read in the 10 values..
for (byte n=0; n
'' 10; n++)
{
// read value on thermistor pin i.e. analog 0

mySamples[n] = analogRead(thermistorPin);

// delay 1 second

delay(1000);

}//for(n)


//..then print them to the SM
for (byte n=0; n
''10; n++)
{
// print the analog reading to the SM
Serial.print("Analog reading = ");

Serial.println(mySamples[n]);
}//for()

}//end setup()


void loop(void) //empty loop
{}//end loop()

1 comment:

  1. this took rather longer than i thought it should..

    mind you, it's Stupid-O'Clock in the morning (& i've missed the Soccer round-up), & i AM feeling rather tired..
    ..pack up..
    ..get outa here..
    ..go home..
    & SLEEP!

    ReplyDelete