• 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

CYD 4_2 Temperature Sensor Threshold with Input Field (Thermostat)

Q&A Forum › CYD 4_2 Temperature Sensor Threshold with Input Field (Thermostat)
0 Vote Up Vote Down
Richard Funnell asked 4 months ago

Using Arduino 2.3.4 using the code from the link, the program works.

I am trying to understand the spinbox, I can move the Minus and Plus boxes to a different place but I can’t seem to change the colour of the boxes from the blue colour, (the same as in 4_1 the ‘Wrong Code X’ is also in Blue) also the Set Threshold (25) the 5 has a blue background and could do with changing the size to a larger font. Changing the colour of the Temperature seems to work but the code must be different. Tried to find something on the web but what I did find it didn’t work, error didn’t find command.

Any idea to help me. many thanks

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 months ago

Hi.
Can you tell me what you have tried so far that didn’t work? And the documentation/example you’re using as a reference?
Regards,
Sara

0 Vote Up Vote Down
Richard Funnell answered 4 months ago

Hi,
Sorry but I am getting confused now, I started with Version 1 of the CYD book trying to learn as I go. Like all of your books.
The set up was clear and the Hello World, Calibration Test worked fine with the cross hairs matching after the test.
 
Now I have started again with Version 1.4, downloaded the set-up files, as in Module 1 again.
Hello World worked fine but the Calibration crosshairs didn’t match at all, the results where all over the place.
So I thought I had damaged the CYD device and purchased another. Same result.
Looking at the code in Version 1 it had:
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
 
Now Version 1.4  has :
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320
Not sure why this is?
I saw a report about this recently on the Forum, but it hasn’t helped, I can’t seem to understand why some parts of the code has changed but it still works.
Coming back to the Module 4.2 Temperature Sensor Threshold problem,
Creating the 2 Buttons for the spinbox:
If I change the height of the spinbox
249 lv_obj_add_event_cb(button, lv_spinbox_increment_event_cb, LV_EVENT_ALL,  NULL);
250 button = lv_button_create(lv_screen_active());
251  lv_obj_set_size(button, spinbox_height*2, spinbox_height);
Changed to  lv_obj_set_size(button, spinbox_height*3, spinbox_height);
The width of the 2 Buttons change?
I changed the   lv_obj_set_width(spinbox, 60); to 30, this only changed the spinbox width with 25 (default) inside.
What value does the: int32_t spinbox_height = lv_obj_get_height(spinbox);  get?
 I have search the LVGL Documentation 9.0 site but can’t find anything.
DEBUG:
 int32_t spinbox_height = lv_obj_get_height(spinbox); Serial.print (“Spinbox Ht”); Serial.println (spinbox_height);
This printed 36.
Added this to the next line:  spinbox_height = 50;
This increased the 2 Buttons Height and width, but the spinbox stayed the same size?
I was also trying to change the colour of the buttons with plus and minus signs.
Using:
249  lv_obj_add_event_cb(button, lv_spinbox_increment_event_cb, LV_EVENT_ALL, LV_PALETTE_RED);
Didn’t compile.
I need to try and make the 2 Buttons and the spinbox Taller, the text size 25 inside the spinbox Bigger without the 5 being in blue?, and would like to change the colour each of the Buttons.
I just try and change things to learn, but if things like #define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320 seem the wrong way round it’s hard to understand what I have to do.
Sorry for the long text.
Can send pictures if you need them. Thanks for your time..

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

Hi.
 
With the new version of the LVGL library, our examples got the rotation messed up and only worked with those settings.
 
If you’re using the examples in version 1.4, you also need to install the libraries as mentioned in that version (the instructions are slightly different). You need to remove all files related to the TFT eSPI library and LVGL and start the installation again.
 
If the touchscreen doesn’t seem to match the display, maybe you need to rotate the touchscreen in a different way.
 
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

  • [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.