This program is done as an Lab assignment for ECE2036.

Dependencies:   4DGL-uLCD-SE PinDetect SDFileSystem mbed

Fork of mythermostat by jim hamblen

This program is a lab assignment to ECE 2036. It uses uLCD, pushputtons and SDCard via sdFileSystem. This is designed as a concept to train animal that could be used by biologist to determine if lemurs have a concept of numbers. uLCD is divided into two different rectangle. In each rectangle, program generate random shapes of different color. Pushbutton is used to select which side has smaller number of shapes. Each trial, result is stored in sdCard as datalogging.

Committer:
4180_1
Date:
Thu Jan 31 03:15:20 2013 +0000
Revision:
2:58d85409f7ff
ver 1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 2:58d85409f7ff 1 #include "mbed.h"
4180_1 2:58d85409f7ff 2
4180_1 2:58d85409f7ff 3 //Setup a new class for TMP36 sensor
4180_1 2:58d85409f7ff 4 class TMP36
4180_1 2:58d85409f7ff 5 {
4180_1 2:58d85409f7ff 6 public:
4180_1 2:58d85409f7ff 7 TMP36(PinName pin);
4180_1 2:58d85409f7ff 8 TMP36();
4180_1 2:58d85409f7ff 9 operator float ();
4180_1 2:58d85409f7ff 10 float read();
4180_1 2:58d85409f7ff 11 private:
4180_1 2:58d85409f7ff 12 //class sets up the AnalogIn pin
4180_1 2:58d85409f7ff 13 AnalogIn _pin;
4180_1 2:58d85409f7ff 14 };
4180_1 2:58d85409f7ff 15
4180_1 2:58d85409f7ff 16 TMP36::TMP36(PinName pin) : _pin(pin)
4180_1 2:58d85409f7ff 17 {
4180_1 2:58d85409f7ff 18 // _pin(pin) means pass pin to the AnalogIn constructor
4180_1 2:58d85409f7ff 19 }
4180_1 2:58d85409f7ff 20
4180_1 2:58d85409f7ff 21 float TMP36::read()
4180_1 2:58d85409f7ff 22 {
4180_1 2:58d85409f7ff 23 //convert sensor reading to temperature in degrees C
4180_1 2:58d85409f7ff 24 return ((_pin.read()*3.3)-0.500)*100.0;
4180_1 2:58d85409f7ff 25 }
4180_1 2:58d85409f7ff 26 //overload of float conversion (avoids needing to type .read() in equations)
4180_1 2:58d85409f7ff 27 TMP36::operator float ()
4180_1 2:58d85409f7ff 28 {
4180_1 2:58d85409f7ff 29 //convert sensor reading to temperature in degrees C
4180_1 2:58d85409f7ff 30 return ((_pin.read()*3.3)-0.500)*100.0;
4180_1 2:58d85409f7ff 31 }