• 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

ADVICE FOR BEGINNERS: Use ChatGTP as 24/7 online teacher!

Q&A Forum › Category: Other › ADVICE FOR BEGINNERS: Use ChatGTP as 24/7 online teacher!
3 Vote Up Vote Down
Erik de Ruiter asked 8 months ago

The RN Ebooks are very good, thanks to those I can enjoy my hobby because I’m not 20 anymore
but sometimes I need clarification about a line (or many lines) of code!

For example:  I stumbled across this line of code:

LV_UNUSED(obj);

Asking ChatGTP (“EXPLAIN LV_UNUSED(obj);”)  I got this explanation:

`LV_UNUSED(obj)` is a macro commonly used in the LVGL (Light and Versatile Graphics Library) to avoid compiler warnings about unused variables. In C and C++, when a variable is declared but not used, some compilers will issue a warning. To suppress these warnings, the `LV_UNUSED` macro is used.

Here’s what happens:

1. `LV_UNUSED(obj)` is designed to “use” the variable `obj` in a way that does nothing but satisfies the compiler.

2. It typically expands to something like `(void)(obj);` — this is a no-op (no operation) that casts the variable to `void`, effectively telling the compiler that you are aware of the variable, and its lack of usage is intentional.

This is particularly useful in cases where certain variables may be conditionally unused (e.g., in different configurations, debugging modes, or depending on compiler flags).

### Example:
void my_function(lv_obj_t * obj) {
LV_UNUSED(obj);
// Function implementation without using 'obj'
}


In this example, LV_UNUSED(obj) prevents a warning when the obj parameter isn’t used in the function.

You also can ask ChatGTP to add comments to the code: TYPE: ADD COMMENTS and then paste the code on the next line.

I hope you will benefit of this! 🙂

Question Tags: CHATGTP
4 Answers
1 Vote Up Vote Down
Rui Santos Staff answered 8 months ago

Thank you for the insight! It definitely helps 🙂
However, sometimes you need to double-check the information as it also frequently provides incorrect info.
Regards,
Rui

0 Vote Up Vote Down
mark answered 7 months ago

Thanks for this tip. I have been using chapgpt for asking questions and even some code generation (with caution), your suggestions have broadened my potential use cases.

1 Vote Up Vote Down
William Lucid answered 7 months ago

Good Morning

Have been using Googles Gemini; much like ChatGPT for: help with coding.  Advantage of Gemini you can create a share link of a single prompt or the entire chat.  Also, Gemini can Gmail or create a Google document.

Here is a share link to an entire chat for a task scheduler:  Task Scheduler –entire Gemini chat

Remember the more detailed prompt you type; better the result.  Do use as many lines needed for prompt.  Additionally you may upload your code for help with debugging.  Generated code will likely require your debugging skill.  Sometime you can submit genenerated code for Gemini to debug.

Found this reference on setting the time zone:  TZ:NTP TZ Reference

Here are some example TZ values, including the appropriate Daylight Saving Time and its dates of applicability for North American Eastern Standard Time (EST) and Eastern Daylight Time (EDT), the normal offset from UTC is 5 hours; since this is west of the prime meridian, the sign is positive. Summer time begins on March’s second Sunday at   2:00am, and ends on November’s first Sunday at 2:00am.

Regards,
William

1 Vote Up Vote Down
Bruce Develle answered 6 months ago

I’ve been using Microsoft Copilot for similar reasons. I can’t overstate how helpful it is with understanding C++ code that I don’t understand. Just send it a code snippet and ask it to explain the code. Then follow up with more questions until you get a full explanation.
And afterwards, ask Copilot to comment and format the code so you can paste it back into your program if desired. This has been the best, and by far the fastest way to understand 3rd party code. Wouldn’t want to code without it now! 
As William states above, the better your question, the better your answer. Be as specific as you can in your question. Don’t leave out any details, or you’ll find yourself having to ask follow-up questions. 

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.