Home ArduinoArduino Code Tick Tock Shield temperature example

Tick Tock Shield temperature example

by shedboy71

Here is a picture of the Tick Tock Shield, this shield is ideal for beginners as it has several components such as a buzzer, LDR, LEDs, temperature sensor, buttons and 7 segment displays.

Tickshield

Tickshield

 

In this example we will get the temperature from the on board sensor, the sensor is connected to A0 and we will see the temperature via the Serial Monitor output

 

Code

[codesyntax lang=”cpp”]

#define TEMPERATURE_SENSOR 0

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  float temperature,resistance;
  int a;
  int B = 3975;
  a = analogRead(TEMPERATURE_SENSOR);
  resistance   = (float)(1023-a)*10000/a; 
  temperature  = 1/(log(resistance/10000)/B+1/298.15)-273.15;
  Serial.println(temperature);
  delay(500);
}

[/codesyntax]

Results

Open the serial monitor and you should see something like this

23.04
23.04
23.48
24.17
24.61
25.04
25.39
25.66
25.83
26.10
26.27
26.45
26.54

Links
1PC Real Time Clock Shield Digital Tube Module Thermal RTC TM1636 DS1307 For Arduino

You may also like