Seems like it’s getting hot in here! How about writing some lines using the Temperature sensor shield to turn
on the fan automatically!?
This shield is one of the sensor shields. Sensor shields allows you to tap into your smartphone’s sensors and use in prototyping with Arduino, you can get information from the surrounding environment and use it to trigger a certain action.Learn more from the sensor shields tutorial.
Temperature sensor sense the temperature surrounded in degree celsius.
Adding #define CUSTOM_SETTINGS along with #define INCLUDE_TEMPERATURE_SENSOR_SHIELD is a key that will let you unlock the Temperature sensor shield only amongst all shields and prevent 1Sheeld library from eating your memory specially for UNO board.
Get the temperature values sensed.
Returns a char holding the temperature value.
char value = TemperatureSensor.getValue();
Get the temperature values in Fahrenheit.
Returns a float holding the temperature value in fahrenheit.
float value =TemperatureSensor.getAsFahrenheit();
Sets a certain individual function written by the user in the sketch to be called and runs its functionality each time a new temperature is sensed.
&userFunctionName: takes the physical address of the userFunction in the memory and jump to it once called to execute it’s functionality.
/* myFunction exists under the loop function. */
/* This function will be invoked each time new temperature is sensed. */
void myFunction (char tempValue)
/*Print out the temperature values. */