Learning the Code only...

I have bought the Arduino Mega 2560 Starter Kit from Oddwires. I have gone through all the examples intending to learn Arduino, yet i feel like i was just "going through the motions". I have not learned much to do the coding on my own from scratch. Can anyone help me figure out how to properly learn the code itself and not just "go through the motions" again?

Any help is appreciated.

I’m not familiar with that kit but all I can suggest is pick yourself a project. You bought the kit with something in mind I assume? Building a line following robot, house automation?

Well i bought the kit wanting to learn arduino, and eventually learning to build a uav/quadcopter or track robot. But i cant even learn the coding, and you mentioned starting a project; is it a good idea if i don't really know the code? because i was thinking i might have to constantly ask what code i should put [here] to do [this].

Thanks for the help and feedback.

A few suggestions...

Don't just load the example/project programs or copy/paste them... Type them in by hand.

Try to understand what each line of code is doing. Refer to the Language Reference frequently. Read-through the Language reference if you haven't already done so.

Modify the examples to make them do something different. For example, modify the Blink example for different on & off times. Make the blink-on of blink-off time (or both) random within limits of your choice. Add one or two more LEDs and make them blink in a particular sequence.

Take the Blink Without Delay example, and modify it to blink two LEDs independently at different blink-rates. You'll probably need multiple timers running at the same time eventually, and you need to know how to time something while your program keeps running.

Modify the other examples in ways that you find interesting, or in ways that might eventually apply to your robot project.

Try to create your own projects/experiments to make something you find interesting, or something that will eventually apply to your robot project. If you need some additional hardware for your own projects/experiments, buy it!

The two most important programming concepts are conditional execution (if-statements, etc.) and loops (doing things over-and-over, usually until come condition is reached). Of course, there's a LOT more to programming than that... People get college degrees in programming (Computer Science), but once you understand those two concepts you should start to understand how programs "work".

For learning programming that's not specific to the Arduino -

Get an introductory C or C++ programming book and a compiler (to write programs on your computer). You'll be learning command-line programming (not GUI Windows) and a lot of it won't apply to the Arduino, but you will be learning programming. I learned C & C++ before I ever played-around with the Arduino and that made it really easy to look at the Programming Reference for the stuff that's unique to the Arduino. (I'm not an expert programmer, so I refer to the Arduino Language Reference and my books a lot.)

Look for a book with "homework" assignments so you can evaluate your progress. I liked Teach Yourself C in 21 Days and Teach Yourself C++ in 21 Days. (Some people hate these books, but I liked them.)

[u]cprogramming.com[/u] has tutorials, book recommendations, compiler recommendations, a forum, and all kinds of stuff to help you learn programming.

The best way to learn programming, especially if it's your first programming language is to take a class. With a class your learning is structured, you have an instructor and fellow students to lean from, you get homework, quizzes, and tests to evaluate your learning, etc. I never took a C/C++ class, but I'd taken classes in a couple of other programming languages before studying C/C++.

...There's enough information on the Internet to learn brain surgery, but knowing where to find it, what to study first, etc., means that most brain surgeons go to medical school! :smiley: :smiley: Most professional programmers go to school too!

Thanks so much for that info. That helps more than you can imagine. Obviously, i dont know how to program in advanced coding or some fundamental coding languages. *(i really only know HTML and CSS by heart as far as any general coding goes, i know thats not relevant to programming electronics) :sweat_smile: And i have changed the coding in the examples like it says but it didnt really do much for me. However, i will be looking into your books you recommended and will be following your advice. Thanks so much for the help, cant begin to explain how much you've help me understand the coding aspect and what to do next.

Take the Blink Without Delay example, and modify it to blink two LEDs independently at different blink-rates.

Best. Advice. Ever.

Get this timing stuff under your belt (without using delay) and so much will fall into place.

Similarly, if you can get the notion of monitoring the change in a pin's status clear in your mind, that will stand you in good stead too. That means you know that a switch has just become pressed (or unpressed) not simply that it is pressed (or unpressed): ie its state changed since the last time you looked. This is a good example of that.

Then read the thread on this forum: Planning and Implementing an Arduino Program and re-write one of your experiments using those principles.