Notifications
Clear all

C# on ESP32

14 Posts
4 Users
2 Likes
4,578 Views
byron
(@byron)
No Title
Joined: 4 years ago
Posts: 1105
Topic starter  

For some unfathomable reason some seem to prefer C++ over python (masochistic deviants I presume 😀) and even worse some that like C# (thinking of you mr @robo-pi).  Well I was shocked to see that some folk are getting C# running on all sorts of boards and I saw one I recognised -ESP32_WROOM_32.

https://github.com/nanoframework/Home  

This deviant behaviour needs to be stamped out forthwith before newbies get corrupted. 😎


   
Quote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 4 years ago
Posts: 1669
 

C#'s the way to go!
It's the language of choice for those in the know
It beats C++ and Python too!
as the best language ever, through and through

With C# syntax coding's a breeze
it allows you to program with effortless ease
She's the cream of the crop in computer linguistics
the ultimate Queen of coding logistics.

With her powerful code you can whip up an app
and have it debugged in a fractional snap
So beware of the Python!
That slithering snake!
It will eat you for breakfast, and your spirit will break.

So its better to learn the code that's the best
The code that is higher and above all the rest
I'll just say it once and won't bother to harp
The Queen of computing is done in C#.

DroneBot Workshop Robotics Engineer
James


   
truckmen and codecage reacted
ReplyQuote
byron
(@byron)
No Title
Joined: 4 years ago
Posts: 1105
Topic starter  
Posted by: @robo-pi

The Queen of computing is done in C#.

The Queen was in her office, coding C, it can be done
The King was doing Python and was having much more fun
Robots were in the garden tending all the flowers
The Queens robot went haywire and it chopped off a blooming rose

The Queens robot had a big bug, well it was done in C
A pointer missed, a malloc made, the buffer, oh dear me!
The King was called, the busy man just sent along a pupil
The robot is now working fine, It got coded up with tuples


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 4 years ago
Posts: 1458
 

I hate frameworks, and you can't learn how to program from using a framework, so newbies beware!

 


   
ReplyQuote
triform
(@triform)
Member
Joined: 4 years ago
Posts: 324
 
Posted by: @frogandtoad

I hate frameworks, and you can't learn how to program from using a framework, so newbies beware!

 

I tend to agree with this, but working as a software engineer or whatever they call us now you have to live with them...  AT WORK!!!!  Not at home!!!!!!!!  🙂

Now for C#. I actually like C# as a language. It's better than C++ and was *cough* well thought out.  Now let's not ask me about .NET 😉  There is an interesting NON-CLR C# in development that is geared for game devl, but could potentially be used for other coding.  It's call Beef.

C is the language of love!!  Via C! 

I miss old Uncle Dennis 🙁  A man that truly changed the world.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 4 years ago
Posts: 1105
Topic starter  
Posted by: @frogandtoad

I hate frameworks, and you can't learn how to program from using a framework

OK your a framework hater, but I thought you were going to create one some time back (for what I cant remember) so I don't think you regard a framework as evil 🤨.  Frameworks do have their uses, like getting a web site up and running with Django, and one can use frameworks without having to become an expert in whatever language one is using.   Many are not endeavouring to become an expert, just enough to get their hobby project working, but I would not think anyone is using a framework to learn to program.  If they are  your warning will no doubt abuse them of the very idea.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 4 years ago
Posts: 1458
 

@triform

I like C# too, and in fact... I like and use a lot of languages!  It's good to learn more than one language, as I believe it will help to make a better programmer, though I consider the art of programming more conceptual, i.e:- understanding programming concepts, data structures and where and why to use specific features of a language, rather than the language syntax itself, but there are some areas such as in Arduino programming, where C and C++ excel, and have proven themselves over a long period of time in the embedded world, to be the language of choice.

Too many people these days think that just because some high level syntax language is easier than another, therefore it must be the language of choice to use... it's funny however, why so many of these new languages want to emulate the best, as proven over a long period of time, isn't it? 🙂

Indeed, personally, I love C++ and OOP programming under C++, but I use the right tool for the job when and where necessary, and in the Arduino world, C++ is indisputably the right tool to use, with many online references and books to support that view in conjunction with mine.

 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 4 years ago
Posts: 1458
 

@byron

Posted by: @byron

OK your a framework hater

From a learning perspective, 100% yes I am!

Posted by: @byron

I thought you were going to create one some time back (for what I cant remember) so I don't think you regard a framework as evil :-).

Possibly, but you're right... they're not totally evil, if say for example you are working for a company where a specific framework is endorsed and supported with training etc... and contributes to your job and therefore livelihood!

Posted by: @byron

Frameworks do have their uses, like getting a web site up and running with Django, and one can use frameworks without having to become an expert in whatever language one is using.

Django for example meets the criteria I mentioned above, but I disagree with your premise, it's not worth learning for one off projects (especially for newbies), because it is actually very difficult to learn, and you literally do have to become an expert to know how to use it properly!

Posted by: @byron

Many are not endeavouring to become an expert, just enough to get their hobby project working, but I would not think anyone is using a framework to learn to program.  If they are  your warning will no doubt abuse them of the very idea.

Frameworks are complex beasts, and actually require a lot of time to learn them, just like Django does... you can spend hours and hours of time in Django to do something that would have only taken you 10 minutes in plain old HTML and JavaScript!

...which brings us back to the point... for those who don't know C#, and you're learning Arduino... don't you now have to spend time learn a C# framework to create a simple project? Why not spend the same time learning the true embedded language of choice that is ANSI/ISO standards compliant and recognised around the world with transferable skills?

Frameworks are not easy to learn, that's a myth, and the appreciation of their knowledge is very limited to only specialised companies that choose to use them.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 4 years ago
Posts: 1105
Topic starter  
Posted by: @frogandtoad

for those who don't know C#

The point of the post I made was, of course, for those that are interested in C#.  That does not include me.  I'm also not interested in learning C++ as my C skills are more than adequate for Arduino.  

Latterly, since the growing advent of microprocessors that can run micropython which I find much more to my taste, all new boards I acquire must have that capability.  Adafruit have championed a derivative of micropython they call circuitpython which is seemingly proving popular for those entering into the electronic and microprocessor hobby, but circuitpython does not have interrupts.  And I like interrupts 😀.  But I think eventually, for hobby use, the use of micropython may be seen as the new boards of choice like the arduino was when it arrived on the scene.  C is more efficient than micropython no doubt, but so what.  For what I do even if the code runs 1000 times slower in processor terms and takes up less memory space, this is just not noticeable to a user at all.

Posted by: @frogandtoad

Frameworks are complex beasts

Some are, some are not.  Too much of a sweeping generalisation I think.  Whilst I have recently been commenting on the fact that I was not minded to use the ROS framework, others clearly find it to be a very enticing prospect.  Good on them.   


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 4 years ago
Posts: 1458
 

@byron

At the end of the day, people will choose what they know best, not what is necessarily the best.

Posted by: @byron

Some are, some are not.  Too much of a sweeping generalisation I think.

Thanks to frameworks, the internet is full of insecure holes in just about every website where they have been used, and when something goes wrong, it takes so long to fix the problem because no one ever learn't how to use the framework properly in the first place, why? because as I said... they are not easy to learn to begin with, and as you alluded to, people just want to get something done quick, because they are lazy!

Laziness has broken the internet and filled it with garbage for that reason.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 4 years ago
Posts: 1105
Topic starter  
Posted by: @frogandtoad

people just want to get something done quick, because they are lazy!

Is writing programs in C++ instead of assembly being lazy?  Of course not.  It's all a matter of perspective.  Do I want to write a program to control my z-wave switch, or do I want to use a ready baked API.   Its the API for me, thought I do make any claims that I am not lazy.  I often am according to my wife.

This post was modified 4 years ago by byron

   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 4 years ago
Posts: 1458
 

@byron

No, because there is a massive jump in technology and far lesser support for assembly these days, and C and C++ do strike a happy medium between such a low level language and modern day languages.  Having said that however, if you choose to, you have the flexibility and can write assembly directly in most C++ IDE's, including Arduino if you have the stomach for it 🙂


   
ReplyQuote
byron
(@byron)
No Title
Joined: 4 years ago
Posts: 1105
Topic starter  
Posted by: @frogandtoad

can write assembly directly in most C++ IDE's, including Arduino if you have the stomach for it 🙂

calling C functions from python is the limit for me, along with the use of many a github library contribution where I do not choose to stray into the code.   Each has their own happy medium no doubt.


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 4 years ago
Posts: 1669
 

I don't want to step into any serious opinionated wars here.  But I would like to offer my experience and perspective on this.

I too was from the "Old School" where languages like C and C++ were viewed as the  "real thing" while languages more akin to Python were seen as the "new-age" programming languages for people who were too lazy to learn "real code".

Especially features like not having to specify the variable type appeared to be the height of laziness.  There are also times when it makes sense to specify a specific variable type.  Fortunately Python actually provides for this.

In any case, I think there actually may have been some merit to this view that Python is a language for lazy people who don't want to learn real code.   In the early days of Python that argument could actually hold some merit.  However, I believe those days are long since over.   The main reason being that Python has been continually developed over the years.  In fact, many of the features of Python are actually libraries that are indeed written in languages like C and C++.   So ironically people who use Python are actually using C and C++ without even realizing it.  They simply don't need to code those functions because they just import them as libraries now.

However, where Python really shines today, is not so much because it's a great programming language, but because so many people are developing code using Python.   To refuse to learn Python at this point is to cut yourself out of being able to use and understand many useful programs that other people are developing. 

This is especially true in the filed of AI where Python has become the language of choice among AI researchers.   And again, not so much because of the power of Python itself, but because there are so many libraries written for Python that are specifically aimed at developing AI.

I made the grave mistake of putting off learning Python for far too long!   When I finally did learn Python it was like opening up a floodgate of resources in the field of AI.

So ironically when it comes to Python it's not even about a "Programming Language" anymore. It's about having access to what everyone else in the AI community is doing.   If anyone wants to get into AI Python is the floodgate you want to open for yourself.  If only because that's the language the vast majority of AI researchers are using.

~~~~

Also there's no need to restrict oneself to just one programming language.  I would still use C# for writing Windows Forms programs.  In fact, it would be ludicrous to even try to use Python for that application.  That would be like trying to go for a swim in a straight-jacket.

~~~~

Here's the real scoop:

When people adapt languages like C# or even Python to microcontrollers that were designed to run C++ or some other hardware-oriented language is because they are simply comfortable with C# or Python and don't want to bother trying to learn C++ (which is indeed more difficult to learn).   It's understandable that they want to use languages that they already know and are comfortable with.  Why not?  I don't blame them at all.

To argue that C++ might be a more efficient or effective language in those situations is basically a meaningless argument.   More effective or more efficient for who?  The CPU?    Who cares about the CPU?  The programmer cares more about how easy it is for them to program a device.  Now whether or not it's the most efficient code for the CPU.

The only time the latter comes into play is in manufacturing where a manufacture wants to keep the code as small as possible so it doesn't take up a lot of room on a device.    So that's when we take code that is written in other languages and convert it to C++.   

But even that practice is losing importance in today's day and age because it's no longer important to save very byte of memory or demand ever microsecond from processor speed.   The hardware has become fast enough and cheap enough that using less efficient code that's written in higher-level languages is no longer a major problem in most applications.

What do I use?

  • Python
  • C#
  • C++
  • C
  • Assembly Language on rare occasions.

It all depends on what I'm trying to achieve.

For AI development it's definitely Python.

For Windows Forms programming it's going to be C#.

On microcontrollers I'm happy using C++.

I only use C when I'm in dire need of speed or saving bytes.

And I only use Assembly Language in rare hardware interface situations where it simply makes the most sense.  Nothing requires less space or can process instructions faster than Assembly Language.  Assuming the code is written efficiently.  It is possible, of course, to write seriously bad and inefficient code in Assembly Language.  But that's a whole other topic. 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote