Author Topic: Newbie, What is the right way to learn programming?  (Read 6942 times)

0 Members and 1 Guest are viewing this topic.

Offline King123Topic starter

  • Contributor
  • Posts: 18
  • Country: in
Newbie, What is the right way to learn programming?
« on: July 17, 2022, 09:48:01 am »
Hello

This is my first post and I don't know C programming. I want to learn  C programming. I hope the experts here will give me the best advice to learn Embedded C programming.

I have installed code block in my computer. I have also started reading books for C language. I am still finding it very difficult to learn programming. I don't understand how to make learning programming easier.

Do you have any advice to make learning programming easier for newbie?
« Last Edit: July 17, 2022, 09:50:04 am by King123 »
 

Offline Picuino

  • Frequent Contributor
  • **
  • Posts: 726
  • Country: 00
    • Picuino web
Re: Newbie, What is the right way to learn programming?
« Reply #1 on: July 17, 2022, 09:56:02 am »
You can start with an Arduino board to learn embedded programming.
There are plenty of examples and you can get help from many people online in many forums.

You can program Arduino in C or C++. You will see some small difference with these languages because Arduino uses a template to translate the main() function by two other functions: start() and loop().
But the compiler underneath the Arduino software is a GNU C++ compiler.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8172
  • Country: fi
Re: Newbie, What is the right way to learn programming?
« Reply #2 on: July 17, 2022, 10:01:40 am »
Try to find some old tutorials for programming PIC or AVR microcontrollers in C, before the time of Arduino, bloat libraries and frameworks and whatnot.

In other words, make Google return only results pre-2007 or so.

Then start some simple project with said simple 8-bit microcontrollers. You can totally use the Arduino boards and still write code like Arduino did not exist yet.

This way you gain good fundamental understanding of how microcontrollers work and how to program them in C. This all applies to more fancy microcontrollers.

For better idea of C, look at source codes of linux kernel, or some classic linux tools.

I mean, if you use AVRDUDE to program the AVR microcontrollers, why not look at AVRDUDE source code: https://github.com/avrdudes/avrdude/blob/main/src/ just for fun / learning experience. It's written in C, but is more complex and runs on an operating system, making it a different kind of learning experience than the "bare metal" C code you write on AVR/PIC.

Also whenever in doubt with C, either look directly at the C standard, or just google about your problem, instead of assuming. You start building understanding piece by piece.

Getting some good old classic C book is not a bad idea, either!
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3708
  • Country: nl
Re: Newbie, What is the right way to learn programming?
« Reply #3 on: July 17, 2022, 11:01:26 am »
It depends on what your knowledge level on the subject is.

But I would say, start with studying how a microprocessor works. Gaining insight in the deterministic nature will help you understanding how C works too.

See https://www.tutorialspoint.com/microprocessor/microprocessor_quick_guide.htm  or for instance something like this about the 6502 https://codeburst.io/an-introduction-to-6502-assembly-and-low-level-programming-7c11fa6b9cb9 or the Z80 https://www.assemblytutorial.com/z80/

But even the AVR based microcontrollers are fine to learn the basics of it.

Knowing about assembler can help in understanding quite a bit when learning how to program in C.

A book like this one is also useful https://archive.org/details/isbn_9780070145900

Offline Picuino

  • Frequent Contributor
  • **
  • Posts: 726
  • Country: 00
    • Picuino web
Re: Newbie, What is the right way to learn programming?
« Reply #4 on: July 17, 2022, 11:19:39 am »
"The C Programming Language" by  Dennis Ritchie, Brian Kernighan.
It is the c language book written by the creators of the c language. Still one of the best manuals on the language.
If you search a little you can download a digital version of the book.
 
The following users thanked this post: cfbsoftware

Offline abquke

  • Regular Contributor
  • *
  • Posts: 128
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #5 on: July 17, 2022, 12:33:32 pm »
It might be worthwhile to spend some time getting to know C, compilers, and debuggers on a regular computer for a while. This will let you learn things that will be the same as when you're developing for a microcontroller, which will make learning the differences a little more clear.
 

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7517
  • Country: us
  • hp>Agilent>Keysight>???
Re: Newbie, What is the right way to learn programming?
« Reply #6 on: July 17, 2022, 01:01:51 pm »
Hello

This is my first post and I don't know C programming. I want to learn  C programming. I hope the experts here will give me the best advice to learn Embedded C programming.

I have installed code block in my computer. I have also started reading books for C language. I am still finding it very difficult to learn programming. I don't understand how to make learning programming easier.

Do you have any advice to make learning programming easier for newbie?

Not clear if you want to learn programming or you want to learn C programming.

A long, long time ago I learned programming with a very basic computer that had BASIC on it. No arduino or anything else. I just learned how to program - how to get the statements in the language to do what I wanted.

If you want to learn how to program, you can start with C for sure. But I wouldn't worry about Arduinos or anything like that. I would do basic sorts of things like printing and manipulating simple equations and looking at the answers - things like that.

The Book "The C Programming Language" by Kernighan & Ritchie, which I'm looking at right now, has lots of simple examples to start with. Get those examples to work on your computer by looking at screen results and others and you will learn programming.  :-+
I told my friends I could teach them to be funny, but they all just laughed at me.
 

Offline rooppoorali

  • Regular Contributor
  • *
  • Posts: 100
  • Country: bd
Re: Newbie, What is the right way to learn programming?
« Reply #7 on: July 17, 2022, 01:46:25 pm »
I think you're going to the right direction.
 

Offline Christe4nM

  • Supporter
  • ****
  • Posts: 252
  • Country: nl
Re: Newbie, What is the right way to learn programming?
« Reply #8 on: July 17, 2022, 01:47:18 pm »
There are good answers already from people way more experienced than me. I don’t know that many resources myself apart from one I’ll link to below. But I’d like to add something about what you’re about to learn, so you may have a better idea of how you want to go about it. I am going to assume you are starting without any prior knowledge.

I’d say learning embedded programming has 3 main elements to it.

1) Learning the concepts of programming and the mindset of a programmer
2) Learning a programming language, in your case; learning C
3) Learning how microcontrollers work and how this all applies to programming them

Let’s have a look at those in a little more detail.

1) Learning the concepts of programming and the mindset of a programmer
This is learning about such things as variables and variable types, loops, conditional statements, functions and splitting up your program in smaller subsections. About how to test your code. Best practices. Algorithms perhaps, and ways to design and structure your program; i.e. it’s architecture. And so on. You’ll get a feel for *how* to think, as well as the concepts involved in programming. While you learn them at first tied to your first programming language, many ideas are applicable to any language, even if they look very different. Which leads me to the next element.

2) Learning a programming language
This is learning the actual language, C in your case. Compare it with languages like English, or Spanish or French, etc. If 1) is about the ideas of nouns and verbs and how to build a sentence, and such, 2) is the actual language, the words, phrases, saying and idiom. You’ll need to get familiar with the way C does things. What you can and can’t do. And how to “say” what you want to achieve in C. And as with English, Spanish and French etc., There are things that you can easily do in C that another language doesn’t have naturally and you’ll need a workaround. And there are things that are easily done in another language, that C needs a lot of “words” for.

3) Learning how microcontrollers work and how this all applies to programming them
Embedded programming comes with its own set of ideas, and concepts. Now you are applying the above to a specific environment: a microcontroller (MCU). (Embedded programming is broader than only microcontrollers, but I’ll stay with what you mentioned in your first post). You’ll need to learn what a MCU really is, like on the inside. What things like the core, clocks, peripherals, registers, and many more parts are. You’ll learn about GPIO, timers, ADCs and about communication between the MCU and other chips with say UART (Serial), I2C, SPI, for a start. You’ll learn elements of electronics design, so you can understand how to power the chip, and connect it to other things outside it. You’ll learn how to read a data sheet or reference manual and find the information you’re looking for. In summary: you need to come to understand a microcontroller and it’s environment.
When you’re an absolute beginner 1 and 2 will go hand in hand. When you’re more experienced and ever want to try another language, you’ll find that many ideas and concepts in programming are similar, except different languages implement it in a different way. (This is too generic, I know that, and there’s more to the differences in languages. But for now that’s a starting point).

How to get started
So now to your question as to how to get started with this. There are multiple ways to go about it. Here is one:
You could separate 1) and 2) from 3) at first so you don’t get too overwhelmed with all these new ideas. That’s how I leant, by first learning C, and then starting to apply it to a microcontroller. The upside of this is that you are able to focus more on understanding the language and the concepts of programming first. And when you get to learn how the apply to a microcontroller you already know the basics of a language. The downside is, that you may learn things from C that work well for a PC programmer, but are best avoided when using C in an embedded environment. Specifically because the embedded environment puts constraints on what you can and cannot do, and if you only learn C for PC programming at first, you may need to unlearn things when you apply it to a microcontroller.

I don’t think that risk is too high when you’re only just starting out. If you go this route, start by getting familiar with the language C and concepts from variables, types and loops and if/else statements and structs. Pointers too perhaps, but by the time you get there, you’ll likely understand the basics of programming and the language C. That is a good time to switch what you just learned and apply it to a microcontroller. You'll need to decide on a microcontroller type you want to start to learn on. And with that comes a computer program in which you can write the code, compile it and download it into your controller. That's usually refered to by people as the IDE, for Intergrated Development Environment.

I’m not too familiar with (free online) courses or tutorials that I would be able to recommend anything for where you are at. I do highly recommend that when you feel familiar with C and have some experience with a microcontroller that you look up this course on YouTube: Modern Embedded Systems Programming Course. I wouldn’t recommend you start with it. Get to know C a bit first. But when you do, and have some first experience with a microcontroller, it’s a really good one to get in depth insight in how it works on a modern ARM microcontroller. Even if you end up using a different ARM MCU and different programming environment (IDE)

To Arduino or not Arduino
There is an ongoing debate about whether Arduino is a good starting point for learning to program. On one hand, when you are an absolute beginner it may be the quickest way to get you started with an actual microcontroller. However, Arduino does many things for you, specifically to make it so easy for you to just make something. I’d say that is one of its strengths, to provide something for people who just want to make something. The flipside to that, in my opinion, is that you run the risk that you don’t actually learn to program (well). And may even need to unlearn a few things. Depending on where you want to go with programming and microcontrollers, my personal suggestion would be to skip Arduino. This is just my opinion, but without it you’ll more likely to learn to program well. And you’ll more likely to get to understand how a microcontroller works. From personal experience it is very satisfying when you make the microcontroller do exactly what you want, after finding out which registers to set in a certain way. I found I learnt a lot faster that way and I had to really understand what I was doing, rather than typing one line of code that someone else made and does everything for you like a magic black box. It still feels like a reward to me each time.

An option could be to start with using an Arduino Uno as your hardware, with the Arduino PC program to write your code at first. But then actually not use anything Arduino gives as code at all. Just use the board and the software, but learn how to use the actual microcontroller by yourself. Like Siwastaja said above:
Try to find some old tutorials for programming PIC or AVR microcontrollers in C, before the time of Arduino, bloat libraries and frameworks and whatnot.
The Arduino Uno uses a Microchip (Atmel) ATmega328P. If you search for AVR programming you can find many examples from people who learned to program these before Arduino existed. Eventually though, you will want to use something else than the Arduino software with more capabilities and more control for you. So perhaps skipping it altogether is still the better option.

(edit: some typos)
« Last Edit: July 17, 2022, 01:51:53 pm by Christe4nM »
 
The following users thanked this post: Picuino, DiTBho

Offline abquke

  • Regular Contributor
  • *
  • Posts: 128
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #9 on: July 17, 2022, 09:15:05 pm »
I've been reading this book:
https://nostarch.com/bare-metal-c
and the first half has been a reasonably practical introduction to C. The overall motivation is towards microcontroller programming, so that's a leg up on most programming texts.

The K&R C book is good for reference, but not good for learning the first time out in my opinion.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #10 on: July 21, 2022, 02:40:05 pm »
The K&R C book is good for reference, but not good for learning the first time out in my opinion.
The K&R book is loaded with conversion functions like itoa() and such.  These can be replicated in a uC project where it is not desirable to bring the entire printf() function and all the related string functions into the project.  I use the conversion functions all the time!

The easiest way I know of to learn C is under Linux.  I would probably install gedit for the editor and follow the instructions for gcc:

https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

This will create a nice development environment.  Later on, you need to make sure that 'make' is installed and up to date.  This will simplify projects spread over multiple files and multiple directories.  Later...

If I were thinking in terms of Raspberry Pi, I would get one of the starter kits from Amazon.  There are many incantations but the code included with the Freenove is known to work on a Pi

https://www.amazon.com/Freenove-Complete-Raspberry-708-Page-Tutorials/dp/B09ZXNL2WH

You can use either a Pi 4 or Pi 400.  Think about the Pi 400, all you need to add is a monitor and you have a decent Linux workstation and a place to play with C projects.  It can be used as discussed above to just learn C or you can do the experiments in the starter kit for which code is provided.  There's a lot of education in this kit!

Buy the 3 item package deal because you will need a capable wall wart and having a power switch is handy.  Any monitor with HDMI input should be adequate.

https://www.amazon.com/Raspberry-400-Computer-Kit-RPI400-US/dp/B08MYVQW1S

The Raspberry Pi 4 will work just as well but you need a spare keyboard and mouse.
« Last Edit: July 21, 2022, 02:53:56 pm by rstofer »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #11 on: July 21, 2022, 03:03:59 pm »
Depending on a lot of stuff, you might be able to take a C programming course at a local college.

Simply looking at someone else's code isn't really a learning experience unless you are already a better coder than they are.  You need to spend time behind a keyboard.

I just noticed you are in India, I have no idea what is available.  I would still go with the Linux recommendation simply because it is an easier place to play.  You can also do C projects using Microsoft Visual Studio (although they certainly hide the C capability).  Check out:



There are literally thousands of books on C programming and you can follow along by typing the projects.  I find that I learn more when my fingers and eyes are linked.

The subject of 'programming' is large regardless of the language.  Pay attention to how projects are structured.

And, yes, the Arduino is also a good way to go.  The underlying software is written in C++ but you can write the user code in regular C (mostly).
« Last Edit: July 21, 2022, 03:28:04 pm by rstofer »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
« Last Edit: July 21, 2022, 03:13:37 pm by rstofer »
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3708
  • Country: nl
Re: Newbie, What is the right way to learn programming?
« Reply #13 on: July 21, 2022, 03:58:03 pm »
If I were thinking in terms of Raspberry Pi, I would get one of the starter kits from Amazon.  There are many incantations but the code included with the Freenove is known to work on a Pi

https://www.amazon.com/Freenove-Complete-Raspberry-708-Page-Tutorials/dp/B09ZXNL2WH

Looks like a nice kit, but together with the Raspberry PI it is quite a bit of money, and there is no telling if the original poster can afford it.

There are cheaper options like an Arduino Uno clone with a cheapish kit from Aliexpress.

I'm not one to advise the Arduino IDE and framework for proper learning to program, but it is an easy way to get started.

For learning pure C a computer running linux certainly is a good place to start. The simple "hello world" projects and start building from there to get more things done, but the original poster did state he/she wants to learn "embedded" programming. Then it is debatable if Raspberry PI with linux classifies as embedded programming.

A Raspberry Pico springs to mind as an interesting platform to play with. Also very cheap.

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #14 on: July 21, 2022, 07:16:01 pm »
I just bought 2 of the Raspberry Pi Pico W (wireless) boards from Digikey at $6 each.  I'm assuming I can use the Micropython tools I was using for the non-W version.  I just got the boards, I haven't tried them.

Micropython is pretty interesting.  I use the Thonny toolchain

https://thonny.org/

I have to go looking for wireless examples.  I found an HTML Server project but I would be more interested in a Berkeley Sockets demo.

 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: ca
Re: Newbie, What is the right way to learn programming?
« Reply #15 on: July 22, 2022, 04:18:56 pm »
I have installed code block in my computer. I have also started reading books for C language. I am still finding it very difficult to learn programming. I don't understand how to make learning programming easier.

Learning is difficult. It takes time and effort. Nothing you can do about this.

There are many shortcuts, but they typically work by avoiding learning rather than by making learning easier. Be careful not to fall in such a trap.
 
The following users thanked this post: newbrain, pcprogrammer

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 494
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #16 on: July 22, 2022, 04:46:51 pm »
Learning to swim was easy: I jumped in a pool. I didn't jump into the deep end because it was over my head, so I started in the shallow end. I probably started by doggy paddling, but soon learned a few different ways to propel myself through the water. Eventually, I was comfortable in the deep end. The entire process, from beginning to end was relatively undramatic.

I started programming in C as a student, developing routines that I needed to either generate data (simulations) or process data. It was all pretty much command line driven, shuffling text files around in the great Unix tradition. Not a lot of drama there either.

When I first started programming MCU's it was in C using a 16 bit PIC. Writing code in C was natural for me, even things like pointers and arrays of pointers to functions were simple to understand. But setting up a PIC to read and write GPIO started out as a bigger step than I felt comfortable with. There was a longer, steeper learning curve than I was used to. Using timers to generate PWM that could be adjusted on the fly was another big hurdle. Today, this stuff is not difficult because I understand the concepts, but at the time it was a lot of work for a relatively small reward.

The problem was that there was no shallow end when it came to embedded programming. It was necessary to jump directly into the deep and and struggle to stay afloat without drowning. The Arduino ecosystem and IDE, etc provide a shallow end. So, when asked by a newbie about embedded coding, I always recommend starting with an Arduino or something compatible with the ecosystem. (I'm fond of Teensies, but Adafruit Feathers have advantages of their own.) They're easy just like the shallow end of the pool.

I never recommend that a beginner start by studying IO and timer registers before attempting to make a working program. To me, it makes far more sense to get something working on an Arduino-like board. Later, you can replace digitalWrite() with direct register manipulation. After that, registers will make a little more sense and you can start setting up and using timers through direct register manipulation. It's learning in bite size pieces, and it's way more manageable than diving straight into the deep end.

Point being that just because one starts with digitalWrite() and analogWrite() and delay() doesn't mean they're stuck there forever. It's just a first step. Many hobbyists don't need to go any farther than straight Arduino libraries and remain ignorant of how the MCU really works. That's fine because their applications don't require any more than that. Some gradually learn about AVR or ARM or whatever and exploit it. Some move on to VS Code and Platformio. Some eventually start designing their own boards and code bare metal. Good for them. Whatever works. And starting in the shallow end is proven to work.

For what it's worth, mostly I do consulting these days and what I'm best known for is developing custom instrumentation that gets used either in R&D labs or on production floors. In other words, not high volume commercial products. At most, a few of a particular instrument will ever get built. There's almost always a custom PCB required, and I could easily design it with an MCU of my choice. But, believe it or not, I continue to use a socketed Teensy 4.0 or 4.1 in most applications. Not only that, but even though I'm familiar with VS Code and Platformio, I still write code that compiles with the standard Arduino IDE. Why? Because that makes it way easier for other engineers to maintain. Simple as that. And it works well enough. I'm not afraid to use hardware specific features, so my code is never intended to be portable, but it should be easy for any EE or programmer to understand and maintain without any special tools that are long gone.

So, Arduinos are appropriate in many situations. Beginning hobbyists that just want to light up a string of LEDs is one. Beginning or experienced programmers that want to learn about microcontrollers is another. And even instruments that will be counted on to function reliably in a professional environment is yet another.
90% of quoted statistics are fictional
 
The following users thanked this post: Electro Fan, Picuino

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #17 on: July 22, 2022, 05:29:16 pm »
I think we need to separate 'coding' from 'programming' if 'programming' includes design.  To that end, I learned to program in Fortran back in '70.  It got to the point that I would draw a rough flowchart of the program's intent before I wrote a single line of code.  I still do that from time to time when the program logic gets very deep.  Google 'flow charts'.

FWIW, the big kids in the COBOL business logic community drew EXTENSIVE flowcharts in a very formal manner.  These were considered a major part of the documentation.  IBM used to provide flowcharts with their distributed libraries.  It was a really big deal.

You draw a flowchart on graph paper, do various walk-throughs to see if the logic is correct and then translate it into the language of choice.
 

Offline Picuino

  • Frequent Contributor
  • **
  • Posts: 726
  • Country: 00
    • Picuino web
Re: Newbie, What is the right way to learn programming?
« Reply #18 on: July 22, 2022, 05:38:47 pm »
Point being that just because one starts with digitalWrite() and analogWrite() and delay() doesn't mean they're stuck there forever. It's just a first step. Many hobbyists don't need to go any farther than straight Arduino libraries and remain ignorant of how the MCU really works. That's fine because their applications don't require any more than that. Some gradually learn about AVR or ARM or whatever and exploit it. Some move on to VS Code and Platformio. Some eventually start designing their own boards and code bare metal. Good for them. Whatever works. And starting in the shallow end is proven to work.

And that is what everyone, who is not sick, does with 32-bit microcontrollers and their more complex peripherals.
One thing is to directly control the registers of an 8-bit microcontroller and quite another to do it with a 32bit one. That's a big deal. Most of them use libraries just like in the Arduino environment.
 
The following users thanked this post: eugene

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 494
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #19 on: July 22, 2022, 05:54:52 pm »
Point being that just because one starts with digitalWrite() and analogWrite() and delay() doesn't mean they're stuck there forever. It's just a first step. Many hobbyists don't need to go any farther than straight Arduino libraries and remain ignorant of how the MCU really works. That's fine because their applications don't require any more than that. Some gradually learn about AVR or ARM or whatever and exploit it. Some move on to VS Code and Platformio. Some eventually start designing their own boards and code bare metal. Good for them. Whatever works. And starting in the shallow end is proven to work.

And that is what everyone, who is not sick, does with 32-bit microcontrollers and their more complex peripherals.
One thing is to directly control the registers of an 8-bit microcontroller and quite another to do it with a 32bit one. That's a big deal. Most of them use libraries just like in the Arduino environment.

I hear that. I have poured over the 3500 page reference manual for the Cortex-M7 in the Teensy 4.0 in an effort to exploit the amazing timers that are available. I eventually ended up using a hardware specific library...

OTOH, not too long ago I needed to output a stream of well-timed pulses with a Raspberry Pi. Well-timed and RPi are mutually exclusive, so I looked for a cheap IC to do the job. What I found was a little 8 bit AVR. Reading the datasheet, setting up the timers and bit-banging SPI-like IO bare metal was so easy. I'd forgotten that programming could be fun.
90% of quoted statistics are fictional
 

Offline andy3055

  • Super Contributor
  • ***
  • Posts: 1111
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #20 on: July 22, 2022, 06:36:13 pm »
A lot of great advice so far. I take a simple approach in learning things. I would start with BASIC and learn the concepts that will apply to any language. Learn how to make flow charts as they are very useful and important in structuring what you want to accomplish.  After that, moving to C will be easy. Just my take on the subject. Good luck.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3708
  • Country: nl
Re: Newbie, What is the right way to learn programming?
« Reply #21 on: July 22, 2022, 06:49:33 pm »
And that is what everyone, who is not sick, does with 32-bit microcontrollers and their more complex peripherals.
One thing is to directly control the registers of an 8-bit microcontroller and quite another to do it with a 32bit one. That's a big deal. Most of them use libraries just like in the Arduino environment.

I would then like to hear your definition of sick.

For me I don't see a big difference between the common peripherals in an 8 bitter and a 32 bitter. Sure there are more complex peripherals and you need to study a bit harder to make use of them, but does that make you "sick" if that is what excites you?

I would not recommend it to a beginner, but with step by step learning it can come in reach. And I agree with starting in the shallow end of the pool, and for me that is first learn what you are playing with, and that is the microprocessor itself. Not learning a programming language directly but first the basics of how a computer works.

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Newbie, What is the right way to learn programming?
« Reply #22 on: July 22, 2022, 09:06:29 pm »
Traditionally, I think there were two ways to learn "programming."

The Top-Down approach.  Go to school and take Computer Science classes for about 4 years, along with the math, science, and EE classes needed to understand the underpinnings, and some social science and humanities classes so that you're aware of some of the human factors, or at least are somewhat able to communicate. Learn a language or two, and stuff about algorithms, data structures, architectures, operating systems, logic, numeric methods, compiler design, and etc.  Graduate with "experience" that varies wildly depending on how many extracurricular or "above and beyond" projects you did.  Struggle with job interviews where technical people conclude that you seem pretty smart, but don't have the experience to tackle the problem that they want solved RIGHT NOW.  :-(

The Bottom-Up approach.  Leap in and start copying code for those Arduinos.  Type in ancient BASIC games for the Commodore-64 emulator you can run on your Raspberry Pi.  Figure out how that stuff works, and start modifying that copied code, improving it, writing your own code, expanding what you know and how much you know about it.  Read a bunch of stuff online and become well acquainted with the perceived strengths and weaknesses of half-a-dozen languages and half-a-dozen CPUs.   Get really good at optimizing C code, so you can talk knowledgibly about how awful digitalWrite() in Arduino's RP2040/MBed core is.  Analyze other peoples' code, and let them ruthlessly analyze yours.  Figure out which advice is good, and which is bad.  Hopefully, read up on (or take online classes in) some of those topics that the CS majors are learning in their classes.  Struggle with getting your resume past HR screening that tags it "no relevant degree." :-(

Nominally, those used to be called "Analyst" and "Coder."  An Analyst would take a problem and create an outline of an algorithm to solve it (perhaps down to "flowchart" level), and then a "Coder" would convert that to code, taking into account the details of languages and how to actually compile, prettying up the output, and etc.  This was supposedly especially prevalent in Business Programming with COBOL - there were "vocational" "programming" classes that turned out "programmers" in not-much-time, without much CS (or other tech) background.

I'd sort-of like to add a THIRD methodology, which I think has become more prevalent as programming has "spread", and perhaps is more applicable to embedded software.   Here, you replace some of the generalized knowledge-gathering with material applicable to a particular application area.  So instead of learning all about queuing algorithms, or all about C on ARM64, you learn "network", "game design", "robotics", or "HVAC technology."  That way, instead of understanding the tools you MIGHT use, you understand the PROBLEMS you might face (beyond getting the cursed program to do what you wanted it to do.)  I vaguely suspect that this is something that is only possible because the first two ways have made some things easy, that used to be difficult.


Christe4nM's post was really good...

 
The following users thanked this post: nctnico, DiTBho, tinfever

Offline LM21

  • Regular Contributor
  • *
  • Posts: 95
  • Country: fi
Re: Newbie, What is the right way to learn programming?
« Reply #23 on: July 25, 2022, 08:15:44 pm »
One good way to learn is really with Arduino boards, but an other easy way is to download and install an IDE for Windows programming, if you are using a Windows PC, that is. That is a start, when you can print something on the screen.
 

Online DiTBho

  • Super Contributor
  • ***
  • Posts: 3915
  • Country: gb
Re: Newbie, What is the right way to learn programming?
« Reply #24 on: July 25, 2022, 08:32:05 pm »
Learn *what* to do *what*? First, define your purpose.
Answers like the above by westfw are the best answer.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf