• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

3.1 Web Server: Dislay Sensor Readings

Q&A Forum › Category: ESP8266 › 3.1 Web Server: Dislay Sensor Readings
0 Vote Up Vote Down
Bob Dehn asked 5 years ago

Where in the code for this project would you convert Celcius to Fahrenheit?

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi.

You can either convert on the main.cpp file on the server side or on the client side using JavaScript.
In the client side (ESP32 or ESP8266), you can do the conversion in the getSensorReadings() function (see the line highlighted in bold:

String getSensorReadings(){
  readings["temperature"] = String(1.8*bme.readTemperature()+32);
  readings["humidity"] = String(bme.readHumidity());
  readings["pressure"] = String(bme.readPressure()/100.0F);
  String jsonString = JSON.stringify(readings);
  return jsonString;
}

Let me know if this works for you.

Also, can you tell me how are you feeling about this new eBook? Is it easy to follow? Is there any topic that you would like to be covered in a future version?

Regards,
Sara

0 Vote Up Vote Down
Bob Dehn answered 5 years ago

Good Evening,

Thanks for the information on the temperature conversion. I have modified my code and it is working correctly.

This is the first book that I have purchased. I am finding the book easy to follow. I would have liked more information about SPIFF and LittleFS. I would have liked more information about where the informarion is saved on the ESP8266. I have been looking online for more information oabout this subject, however have not found what I am looking for.

I think the book is very interestimg and looks forward to additions to the book and also purchasing additional booke.

Good Job

Thanks

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi.
I’m glad that you made it work.
Thank you so much for your feedback about our eBook.
I’ll take that into account in the next eBook update.
Thank you for following our tutorials.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.