• 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

In Learn LVG Ebook, sketch does not run

Q&A Forum › Category: ESP32 › In Learn LVG Ebook, sketch does not run
0 Vote Up Vote Down
Ken Arton asked 10 months ago

Hello,
I have purchased your e-book “Learn LVGL”.
I have worked through modules 1 and 2 with no problems at all.
So now I’m on module 3, and have loaded the “3_1_Display_Temperature_Text_BME280.ino” file.
I have installed the required libraries:   adafruit bme280   and the dependencies,  and have connected the BME280 sensor as instructed.
The sketch compiles and loads successfully with no errors reported.
BUT, nothing happens!  The CYD screen is just blank.
To check that I havn’t broken something, I have gone back to a sketch from module 2, and it works fine.
I don’t think there is anything wrong with my BME280 sensor, because the sketch should report an error with it on the serial monitor, and that shows nothing.
The only thing I can see in the code that puzzles me is the value for duration so that temperature is read every 10 second — it is set at 1000000.  The LVGL website indicates that this value is in milliseconds, so this would give a duration of 1000 seconds.
Can you help ?    Many thanks,   Ken.
 

8 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 10 months ago

Hi.
I think it must be an issue with the BME280 sensor.
Can you double-check the connections? To see if they are not reversed (the SDA and SCL).
Another thing, can you check the I2C address of your BME2800 sensor by running an I2C sketch?
https://randomnerdtutorials.com/solved-could-not-find-a-valid-bme280-sensor/ (don’t forget to change the I2C pins)
You may also have a “fake BME280”. I recommend taking a look at this: https://randomnerdtutorials.com/solved-could-not-find-a-valid-bme280-sensor/
 
Let me know your findings.
 
Regards,
Sara

0 Vote Up Vote Down
Ken Arton answered 10 months ago

Hi Sara,
I’ve checked connections carefully and am sure they are correct.
I have then run the I2C scanner check, and it returns “No I2C devices found”
So I reckon my BME280 sensor is faulty.  I have two of them, bought together some time ago, and they both show same result.
I will order new sensors from a reliable supplier.
Many thanks for your help,   Ken.

0 Vote Up Vote Down
Ken Arton answered 10 months ago

Hi again Sara,
Ignore my previous answer !   I forgot to change the I2C pins.
Having done that, the sensor is detected with address 0x76.
I can see that my sensors are BMP280, so they will not work with sketch as it is.
I have installed library  adafruit_BMP280  and tried editing the sketch for    3_1_Display_Temperature_Text_BME280 to be correct for the  BMP280, by changing all ocurrences of BME to BMP, but it does not compile.
Errors reported as follows:
C:\Users\kenar\ELECTRONICS\RandomNerd\Modules\My_Versions\3_1_Display_Temperature_Text_BME280\3_1_Display_Temperature_Text_BME280.ino: In function ‘void setup()’:
C:\Users\kenar\ELECTRONICS\RandomNerd\Modules\My_Versions\3_1_Display_Temperature_Text_BME280\3_1_Display_Temperature_Text_BME280.ino:160:28: error: invalid conversion from ‘TwoWire*’ to ‘uint8_t’ {aka ‘unsigned char’} [-fpermissive]
160 | status = bme.begin(0x76, &I2CBMP);
| ^~~~~~~
| TwoWire*
In file included from C:\Users\kenar\ELECTRONICS\RandomNerd\Modules\My_Versions\3_1_Display_Temperature_Text_BME280\3_1_Display_Temperature_Text_BME280.ino:29:
c:\Users\kenar\ELECTRONICS\Arduino\My Sketches\libraries\Adafruit_BMP280_Library/Adafruit_BMP280.h:187:53: note: initializing argument 2 of ‘bool Adafruit_BMP280::begin(uint8_t, uint8_t)’
187 | bool begin(uint8_t addr = BMP280_ADDRESS, uint8_t chipid = BMP280_CHIPID);
| ^exit status 1Compilation error: invalid conversion from ‘TwoWire*’ to ‘uint8_t’ {aka ‘unsigned char’} [-fpermissive]
 
Clearly my simplistic edit does not work.  Do you have a version of the modules that will work with BMP280, or would it be better for me to just buy a new BME280 ?
Thanks,  Ken.
 

0 Vote Up Vote Down
Sara Santos Staff answered 10 months ago

Hi.
It is possible to modify the code to use the BMP280.
take a look at the BMP280 library and examples to see how to initialize the sensor and get data from it.  Then, you can try to modify our code.
 
 
I’m currently out of the office until the end of next week. But, I can take a look at that when I come back if you still need help.
 
Regards.
Sara

0 Vote Up Vote Down
Sara Santos Staff answered 10 months ago

Hi.
Just to check out if you were able to fix this issue?
Regards,
Sara

0 Vote Up Vote Down
Ken Arton answered 10 months ago

Hi Sara,
Just received new BME280 module today.
All works properly now.
Thanks,   Ken.

0 Vote Up Vote Down
Sara Santos Staff answered 10 months ago

Great.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

0 Vote Up Vote Down
Ken Arton answered 10 months ago

Thanks 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

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 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.