You are on page 1of 1

// include the library code:

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS_1 0
#define PotPin 2 // analog input pin at analog in 0
#define OutputPin 1 // output pin at 1

#define FlashDelay 200 //


#define PauseDelay 2000 //

int Temperature = 0; //

OneWire oneWire_1(ONE_WIRE_BUS_1);
DallasTemperature sensor_1(&oneWire_1);

void setup()
{
// Serial.begin(9600);
pinMode(OutputPin, OUTPUT); // sets the OutputPin pin as output
digitalWrite(OutputPin, LOW);
analogReference(DEFAULT); // ref=5V

void loop()
{
sensor_1.begin();
sensor_1.requestTemperatures();
Temperature = sensor_1.getTempCByIndex(0);
if (Temperature <= 0)
{
Temperature = 0;
}
for (int i=1; i <= Temperature; i++)
{
digitalWrite(OutputPin, HIGH);
delay(FlashDelay);
digitalWrite(OutputPin, LOW);
delay(FlashDelay);
}

delay(PauseDelay);

You might also like