/*Sensors and Electronic Arts
Group Project: Oulianor Timothee and Evan Trumbull
*/
#include <AF_Wave.h> //Wave Sheild Library
#include <dac.h>
#include <fat16.h>
#include <fat16_config.h>
#include <partition.h>
#include <partition_config.h>
#include <sd-reader_config.h>
#include <sd_raw.h>
#include <sd_raw_config.h>
#include <util.h>
#include <wave.h>
#include <Maxbotix.h> //Ultrasonic Range Finder Library
#include <RxSoftwareSerial.h>
// End Libraries
int lowSensor = 0;
int rngFinder;
int mic;
int temp;
int trigger = 0; //start assuming no motion detected
int s1Pin = 2; // Change these to match the pins
int s2Pin = 11; // the sensors are connected to
int s3Pin = 12; //s1range, s2mic, and s3temp
int close = 50;
int loud = 100;
float warm = 98.6 //98.6 degrees is avg body temp
//unsigned long start, stop, time;
void setup(){
}
void loop()
{
analogRead(s1Pin);
delay(10);
rngFinder = analogRead(s1Pin);
analogRead(s2Pin);
delay(10);
mic = analogRead(s2Pin);
analogRead(s3Pin);
delay(10);
temp = analogRead(s3Pin);
if(triggered == 0) // Neither sensor has been triggered
{
if(rngFinder < close) // Person is close
{
lowSensor = 1; // Record triggering sensor
triggered = 1; // Record the fact that a sensor was triggered
}
if(mic > loud) // Person is loud
{
lowSensor = 2;
rngState = 1;
}
if(temp > warm) // Person is hot
{
lowSensor = 1; // Record triggering sensor
triggered = 1; // Record the fact that a sensor was triggered
}
}
else // one of the sensors was triggered
{
if(rngFinder < close && lowSensor == 2)
{
//stop = millis(); // Record end time
triggered = 0; // Set up to wait for the next person
//time = stop - start; // Compute the duration
/* if(time < fast) // They were really moving... */
{
// play the file here
}
No comments:
Post a Comment