LED glowing instead of blinking and Serial.println issue

I don't know how to get the led light to blink instead of glowing. =(
I don't know how to get the serial.println to print " Outside of the normal body temperature " when the temperature it's outside the stated range. Any help or resources would be appreciated. Thanks :slight_smile: :slight_smile: :slight_smile: :). Below is the code :

#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(" Celsius Requesting temperature...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");

  float temp = sensors.getTempCByIndex(0);

  Serial.print(" Core Body Temperature: ");
  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);
  else
    digitalWrite(ledPin, LOW); 
}

[code]

[/code]

Try this:

  if (temp < 35 || temp > 39.4){
    digitalWrite(ledPin, HIGH);
Serial.println ("Within range");
}
  else{
    digitalWrite(ledPin, LOW); 
Serial.println ("Outside of range");
}

Where is the blinking to occur?

Thanks :slight_smile: , I just want it to blink when the temperature is below 35 or above 39.4

To get the LED to blink you need to turn it off also. to adjust the blink rate delay time

if (temp < 35 || temp > 39.4)
    digitalWrite(ledPin, HIGH);
delay(100);
	digitalWrite(ledPin, LOW);
  else
    digitalWrite(ledPin, LOW);

Thank you for all your help.
The light is not blinking

#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(" Celsius 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(100);
Serial.println ("Celsius, outside normal body temperature range");
}
  else{
    digitalWrite(ledPin, LOW); 
Serial.println ("Celsius, within of normal body temperature range");
}}
[code]

[/code]

So turn it on & off a couple times:

else{ 
Serial.println ("Outside of range");
for (byte x=0; x<5; x=x+1){
    digitalWrite(ledPin, HIGH);
delay (100);
    digitalWrite(ledPin, LOW);
delay(100);
}

you added the delay but not the line to turn it off.

[code][code]whats the line to turn it off????. The following code is not working: [/code]

#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]
I get the following error :
message:50: error: expected unqualified-id before 'else'
message:54: error: expected declaration before '}' token

  else{
    digitalWrite(ledPin, LOW); 
Serial.println (" Celsius, within the normal body temperature range");
}
}

This code is outside of the loop() function.