0

This problem is very recent as I have run the program (standard SHT10 sensor code) successfully many times. But now, all of a sudden, my program keeps repeating void setup() statements and does not execute void loop().

I checked for memory leakage using freeMemory() given here https://github.com/McNeight/MemoryFree. Its showing freeMemory = 1807 on Serial Monitor. SRAM memory is 2K for Arduino Uno.

I have executed this particular program continuously for many days and have used the board simultaneously switching between different programs.

I tried executing other programs too, but the same problem persists. The only program out of all that I tried that works fine is the blink program!

I have even implemented the F() macro but no change.Serial Monitor

What is the problem?

The code is:

#include <SHT1x.h>

#define dataPin 6
#define clockPin 7
SHT1x sht1x(dataPin, clockPin);
float temp, humidity;

void setup() {
  Serial.begin(9600); 
  Serial.println(F("Starting")); }

void loop() {
 temp = sht1x.readTemperatureC();
 humidity = sht1x.readHumidity();

 Serial.print(F("Temperature: ")); 
 Serial.print(temp); Serial.print(F("C"));
 Serial.print(F("Humidity: ")); 
 Serial.print(humidity);Serial.println(F("%"));
 delay(4000); }
  • Have you connected the sensor correctly? Is the sensor broken (gets warm)? – Mikael Patel May 19 '17 at 8:12
  • 2
    restarting is normally a sign of a dodgy power supply or a segmentation fault (programing error). Put a print statement after loop(){ and after temp = ... and see where it is crashing. – Code Gorilla May 19 '17 at 9:02
  • @Code Gorilla I tried your method. The print statement after loop was visible on the Serial monitor. I had just dodged my sensor connections.The code is executing properly now. Thanks. – knowledgeispower May 20 '17 at 5:22
  • @Mikael Patel You were right. Sensor connection was not proper. I had connected VCC of sensor to Reset of Arduino Uno instead of 3.3 V. All is good now. Thanks. – knowledgeispower May 20 '17 at 5:27
  • 1
    You found the answer; post it and accept it to close your question. – user31481 Nov 16 '17 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.