Error message: 55 and 51. Get LED LIGHT TO BLINK instead of glow.

I don't know how to make the LED light blink :

#include <OneWire.h>
#include <DallasTemperature.h>
 
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
 
// Setup a oneWire instance to communicate with any OneWire devices 
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
 
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

const uint8_t ledPin = 13;                 // LED connected to digital pin 13 

void setup(void)
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output

  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}
 
 
void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print(" Requesting temperature...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  
  float temp = sensors.getTempCByIndex(0);

  Serial.print(temp); 
    // You can have more than one IC on the same bus. 
    // 0 refers to the first IC on the wire

  if (temp < 35 || temp > 39.4){
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);    // sets the LED off
   delay(1000);                  // waits for a second
}
    
Serial.println (" Celsius,outside the normal body temperature range");
}
  else{
    digitalWrite(ledPin, LOW); 
Serial.println (" Celsius, within the normal body temperature range");
}
}
[code]

[/code]

I don't know how to make the LED to blink :

Turn it on. After a while, turn it off. After a while turn it on. After a while, turn it off. Repeat as many times as you want.

If you want the LED to blink as long as the temperature is out of range, look at the blink without delay example.

If the temperature is out of range, and the LED is on, and has been on long enough, turn it off.
if the temperature is out of eange, and the LED is off, and has been off long enough, turn it on.

What this has to do with error 50 or error 54, or what the hell those are, or what your code issues are are not at all clear.

  1. Put each { on a new line.
  2. Use Tools + Auto Format.
  3. Post ALL of your code.
  4. Post a reasonable portion of your serial output.

I tried to format the code as best as I could. I am beginner . I just want the light to blink when it is outside range. Thanks :blush: :blush:

#include <OneWire.h>
#include <DallasTemperature.h>
 
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
 
// Setup a oneWire instance to communicate with any OneWire devices 
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
 
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

const uint8_t ledPin = 13;                 // LED connected to digital pin 13 

void setup(void)
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output

  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}
 
 
void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print(" Requesting temperature...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  
  float temp = sensors.getTempCByIndex(0);

  Serial.print(temp); 
    // You can have more than one IC on the same bus. 
    // 0 refers to the first IC on the wire

  if (temp < 35 || temp > 39.4)
{
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);    // sets the LED off
   delay(1000);                  // waits for a second
}
    
Serial.println (" Celsius,outside the normal body temperature range");
}
  else
{
    digitalWrite(ledPin, LOW); 
Serial.println (" Celsius, within the normal body temperature range");
}
}
[code]

[/code]

aduino.PNG

  if (temp < 35 || temp > 39.4){

Is there some part of "Put every { on a new line" that is hard to understand? If there is, I'll try to explain it like you're 5 years old.

Its already been edited check the code above.

Just to make clear what PaulS says :smiley:
Your code, with some added comments :wink: :

void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print(" Requesting temperature...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  
  float temp = sensors.getTempCByIndex(0);

  Serial.print(temp); 
    // You can have more than one IC on the same bus. 
    // 0 refers to the first IC on the wire

  if (temp < 35 || temp > 39.4)  {    // better if alone in a line 
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);    // sets the LED off
   delay(1000);                  // waits for a second
   }    // oups.... end of if statement !!  --> delete this line
    
Serial.println (" Celsius,outside the normal body temperature range");
}  // oups ends loop() !!
  else{   
    digitalWrite(ledPin, LOW); 
Serial.println (" Celsius, within the normal body temperature range");
}

what it should be (with some other comments :wink: ) :

 void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print(" Requesting temperature...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  
  float temp = sensors.getTempCByIndex(0);

  Serial.print(temp); 
    // You can have more than one IC on the same bus. 
    // 0 refers to the first IC on the wire

  if (temp < 35 || temp > 39.4)
  {  
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);    // sets the LED off
    delay(1000);                  // waits for a second
    Serial.println (" Celsius,outside the normal body temperature range");
  }  //end of if
  else
  {
    digitalWrite(ledPin, LOW); 
    Serial.println (" Celsius, within the normal body temperature range");
  }  //end of else
} // end of loop()

and (also pointed out by PaulS :wink: ) , if you don't want to wait 2s (the T° has maybe already decreased ; ) ) , look at the blink without delay axample

thanks alnath, it works perfectly now.

Also, 51 and 55 are not error numbers, they are line numbers where the error is at.