If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Right Language for Programming Microcontrollers

Started by jyotisharma, Jul 31, 2023, 06:39 AM

Previous topic - Next topic

jyotisharmaTopic starter

Which programming language is recommended for programming microcontrollers such as esp32 and Arduino? From my understanding, C and C++ are commonly used languages for programming them.
However, it is also possible to flash the controller, allowing you to write code in Micropython or JavaScript. Personally, I am inclined towards Python, but I am open to considering alternative choices.
  •  


katiezeal

Yes, you are correct that C and C++ are commonly used languages for programming microcontrollers such as ESP32 and Arduino. These languages provide low-level access to the hardware and are highly optimized for embedded systems.

However, it is also possible to use alternative languages like Micropython or JavaScript for programming microcontrollers. Micropython is a lean and efficient implementation of Python specifically designed for microcontrollers, while JavaScript can be used with platforms like Johnny-Five or Espruino.

Choosing the programming language ultimately depends on your requirements and preferences. If you are already familiar with Python and find it more intuitive, Micropython might be a good option for you. On the other hand, if you prioritize low-level control and performance, sticking with C or C++ would be the recommended choice.

additional points to consider when selecting a programming language for microcontrollers:

1. Community Support: It's important to consider the size and active engagement of the community around the programming language you choose. A larger community often means more resources, libraries, and support available.

2. Libraries and Ecosystem: Look into the availability of libraries and frameworks for the programming language you are considering. This can greatly impact your development process by providing ready-made solutions for common tasks.

3. Performance: If performance is critical for your application, C and C++ are generally considered more suitable due to their lower-level access to the hardware and more efficient code execution. However, with advancements in language implementations, high-level languages like Python and JavaScript can still offer good performance for many applications.

4. Development Speed: High-level languages like Python offer quicker development cycles and ease of prototyping compared to lower-level languages like C or C++. This can be beneficial if you prioritize rapid iteration and want to develop applications quickly.

5. Personal Preference and Familiarity: Your personal preference and familiarity with a particular language can greatly impact your productivity and enjoyment during the development process. If you are comfortable with a specific language, it may be easier and more enjoyable for you to work with.

In the end, there is no one-size-fits-all answer and it often comes down to the specific requirements and constraints of your project. You may find it helpful to experiment with multiple languages on smaller projects to get a better sense of which one suits your needs the best.
  •  

expointer

When programming a microcontroller, it is important to remember that there are strict limitations on the resources available, which are determined by the model of the microcontroller. If you are working on a personal project, you may be able to afford a more expensive microcontroller with a larger memory capacity, allowing you to include a full interpreter for your favorite Python language. However, in mass production, this would likely be considered an unacceptable luxury.

It should be noted that the boundaries of what is considered "expensive" or "cheap," as well as the amount of available resources, are relative and constantly evolving. Similar to the way that few people currently concern themselves with the program "appetites" of large computers, it is possible that this will also become the case with microcontrollers in the future.

Additionally, it's worth mentioning that Arduino microcontrollers do not actually exist as standalone entities. Instead, Arduino is a platform that can be implemented using different microcontrollers.
  •  

JPinto

C++ is widely used and provides abundant solutions and opportunities for problem-solving. However, it lacks advantages over C++ and restricts possibilities. Unlike C++, C does not lead to code bloating, but rather the opposite effect.

Considering Rust as an alternative is advisable, but it might be better to wait for another five years until the toolkit and community advance further. Currently, it remains a niche direction.

Developers working under MK usually view Python and JavaScript as marginal choices, suitable for schoolchildren or those who are learning.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...