I have a matlab project in which I am trying to create an alarm clock which sens
ID: 3864953 • Letter: I
Question
I have a matlab project in which I am trying to create an alarm clock which senses daylight and then turns the alarm on. Once the alarm is on I want to use a temperature sensor to confirm that the individual is holding the alarm, and then a vertical vibration sensor to confirm that the individual is up and moving around. I am using an ardunio redboard, mini photocell light sensor, TMP36GZ Temp Sensor, Vertical Vibration Sensor, and an Electro-Magnetic Sound transducer. Can anyone help me out with matlab code to accomplish this purpose, along with an idea of the schematics of how the sensors should connect to the redboard?
Explanation / Answer
answer:
#define TempPin A0
int TempValue;
void setup()
{
Serial.begin(9600); // Initializing Serial Port
}
void loop()
{
TempValue = analogRead(TempPin); // Getting LM35 value and saving it in variable
float TempCel = ( TempValue/1024.0)*500; // Getting the celsius value from 10 bit analog value
float TempFarh = (TempCel*9)/5 + 32; // Converting Celsius into Fahrenhiet
Serial.print("TEMPRATURE in Celsius = "); //Displaying temperature in Celsius
Serial.print(TempCel);
Serial.print("*C");
Serial.print(" | ");
Serial.print("TEMPRATURE = "); // Displaying Temperature in Fahrenheit
Serial.print(TempFarh);
Serial.print("*F");
Serial.println();
delay(1000);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.