Go Down

Topic: serial communication to PC (Read 120 times) previous topic - next topic

ymhatre

Jul 20, 2019, 07:19 am Last Edit: Jul 20, 2019, 07:22 am by ymhatre Reason: Added the code
Dear All

Please help me out in receiving data from a dht11 sensor connected to A0 of Arduino and transmit it to the pc using serial 232.

void loop()

  delay(1000);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  //float f = dht.readTemperature(true);
  lcd.setCursor(0,0);
  lcd.print("Hum =");
  lcd.setCursor(6,0);
  lcd.print(h);
  //delay(500);
  lcd.setCursor(0,1);
  lcd.print("Temp ="); 
  lcd.setCursor(7,1);
  lcd.print(t);
  Serial.print(F("Humidity: "));
  Serial.print(h);
  delay(5000);
  Serial.print(F("%  Temperature: "));
  Serial.print(t);
  Serial.print(F("°C "));
  delay(5000);
}

GolamMostafa

This is not the complete sketch -- a complete sketch should have library file included, declaration of a setup() function etc. Please, post complete sketch using code tags (</>).

groundFungus

#2
Jul 20, 2019, 05:10 pm Last Edit: Jul 20, 2019, 05:12 pm by groundFungus
So what is the problem?  Do you see anything in the IDE serial monitor?  Do you have Serial.begin(baud) in setup()?  Do the baud rates in Serial.begin and the serial monitor match?

Why have you not read the how to use this forum-please read sticky?  That sticky will tell you how to post code properly and has some advice on how to ask a good question.

Go Up