Want to learn Arduino programming

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


Duncanator

Sr Member
I want to learn how to program Arduino boards to use in props, etc...
But! (I'm gonna risk my pride here in the gentle home of the RPF) I don't know anything about how to start.
I've seen some really cool stuff being done with these boards, and I wanna do it too!

I am not a programmer - the only computer programming class I ever took was in 1980, where the languages were Basic, Fortran and Cobal.
I feel a little out of date. All of the tutorials I've come across assume an already learned basic knowledge of the Arduino language, and aren't geared toward beginners.

So, does anyone have recommendations for where to start? And I mean from the REAL beginning.

Thanks Brain-trust!
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

xl97

Master Member
The official Arduino website.. :)

If you have any questions.. I can help .. I have been playing with Arduino stuff for years.


Perhaps start here:



Get the IDE and drivers installed..


Thats the very FIRST step..

Do you have an Arduino already? If not get one.. (or a few)..

I suggest getting an UNO.. most tutorials are based around that board.. or most shields/add-on for that model as well.

Connect Arduino to PC using supplied USB cable..

OPEN IDE.. select board type.. and the COMM port is connected to...

and try to upload the code (referred to as 'sketches') to your board.

Under examples There is a beginner BLINK sketch..

you need nothing but your Arduino connected to PC for this work.

If successful, you will see the upload complete in the IDE.. and the Arduino will be blinking its on board LED (pin 13)

From there is about expanding, knowing you have a working set up.

If you are serious about this..

you will need to buy some components to have on hand at all times:

an assorted resistor pack various values
an assorted capacitor pack various values
a multi-meter (free from Harbor Freight)
leds
jumper wires
breadboard(s)

and the list goes on.....and on....and on..... and on................ LOL



edit:

It also really depends on what it is you want to do.... maybe an Arudino is not the right choice for you?

While its been made as a hobby that is geared toward beginners.. in the end.... the Arduino not a very powerful microprocessor.

You can basically forget about video, or displays.. (unless its a 7-segment or OLED display or something).. but no true video or anything.

That being said.. most of the project I post around here are in still in fact Arduino based.. The Iron Man HUD project also utilizes a RaspberryPi as well....
 
Last edited:

thorst

Well-Known Member
I recommend buying a starter set with many different components. For example, from Elegoo you get the "most complete starter kit" for around 50$, which has an Arduino Uno, a USB cable to connect it, a breadboard, jumper wires, LEDs and resistors, as well as many different sensors, buttons etc. The "tutorials" which come with it are really bad and you should not work with them, and you will probably pay a bit more than if you bought everything on your own, tailored to your wishes. But the big advantage is that you get everything you need for your first steps, and have lots of possibilities right in front of you.

My own experience is that when starting to learn something technical, nothing is more tiring than waiting for more necessary parts which you forgot to buy. If programming is new for you, at least rely on someone else to give you a good starting point for the hardware.
 

zapwizard

Sr Member
RPF PREMIUM MEMBER
Both SparkFun.com and Adafruit.com have tons of guides. The official Arduino site is the best resource for what a certain command does.

As Throst said: Get yourself a $30 or $50 starter kit. They are cheap for the amount of stuff they provide. Once you learn how to write code for an Arduino, you will find the code and concepts port to many other devices. I for example write my stuff in Arduino code, but run that on a lower-power MSP430.

My biggest tip is: After you learn the basics learn how to make a state machine. A real programmer (I consider myself a hobbiest) taught it to me. It has helps me greatly work up to more and more complex code.

A state machine allows you to sort of step in and out of lots of other smaller scripts. Allowing you to virtually multi-task. Too many Arduino programs I find seems to be very linear loops. Loops are great for small simple programs, but limit what you can do if you want to do more. Once you use a state machine as the base of your own programs, you can more easily expand and test the program without ripping up lots of already written code.

If you want, you can pour over the code I made for my Vault-Tec Dosimeter project. It has a few different state machines, and lots of sub-routines.

The code your write will be compiled. That means you can use long variable names without expanding the actual memory size. So don't be afraid to be descriptive. You don't need to use "x" and "y", when "RightHandMotor" and "LineSensor" is more descriptive.

Add lots of comments to your code. This helps when you look at it three months later, and can't figure out where you found some sub-routine, or why you even needed that bit of code.
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

xl97

Master Member
Tip:

DONT USE delay()..

You will see this at first (and all over unfortunately).... but once you get into the 'code' side of things.. LEARN/COMMIT to using millis() vs delay()


delay() is a code blocking function (meaning nothing else executes/happens.. so you can miss things like button presses..etc)

using millis() is like a 'timer' (of sorts).. wheres your 'function' doesnt execute again until a certain time period has lapsed.. but still allows other functions/behavior to happen.. (code to execute)


And yes these are simple enough for a newbie (thats the whole purpose behind the Arduino platform).. making this stuff available/accessible to beginners/hobbyists
 

Dmitriy311

New Member
all these things are good as long as you learn to flash the led and control the motor a little bit. and then it turns out that it is easier to find the piece ready and use it to their advantage. but for this need to be able blink diode. so definitely need to buy a starter kit and a textbook Blum. and correctly said-do not use the delay, use the timer.... what is the easiest way to know English. me to read documentation-need Google-the interpreter (Yes, this I, too, wrote in Google translator)...
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

star-art

Sr Member
I always used to research things like this by reading articles and tutorials on the Web. These days, though, I find it easier to get a grasp on new concepts by watching instructional videos. There are quite a few good ones out there. As already stated, Jeremy Blum is pretty good. I also find this fellow from Canada to be really good at explaining things. Watch enough of these videos and you will be on your way in no time!

DroneBot Workshop
 

masterjedi322

Sr Member
RPF PREMIUM MEMBER
+1 for the starter kit. Comes with an Arduino and a bunch of stuff like LEDs, servos, sensors, so you can learn the fundamentals of how to interface with them.

Sean
 

nkg

Sr Member
RPF PREMIUM MEMBER
Well, I'm going to suggest a somewhat different angle. And that's not to use an actual Arduino at all. Instead, if you're starting out and just playing with what you can do, why not try an educational system aimed at kids? They're super easy to use, and you don't have all the overhead in getting the Arduino IDE set up, learning to write in C, etc etc. Then, if you want to code using the Arduino IDE you can - if you're using the Adafruit Circuit Playground Express, which supports it.

 

Analyzer

Sr Member
I'm in the same boat as Duncanator. I Would love to expand my lighting beyond pre-wired flickering LEDS and static LEDs hooked up directly to a battery
I would really like to have some more animated stuff like a chase sequence (for runway lights) and some "wave motion" effects etc...

Duncanator I am proficient in C and C# so if you need any help on that end let me know. We may actually be looking for the same type of effects programming
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Duncanator

Sr Member
I'm in the same boat as Duncanator. I Would love to expand my lighting beyond pre-wired flickering LEDS and static LEDs hooked up directly to a battery
I would really like to have some more animated stuff like a chase sequence (for runway lights) and some "wave motion" effects etc...

Duncanator I am proficient in C and C# so if you need any help on that end let me know. We may actually be looking for the same type of effects programming

Nice to hear I'm not the only one!
Unfortunately, I don't have any programming/code experience so I'm really starting from scratch.
Once I get the basics, I would definitely appreciate any collaboration!
 

xl97

Master Member
Post away....


The basics of a simple 'blink' sketch wont be lost on you... (even if you are new)..

once you want to do more advanced things.. you will see (and have to learn) more advanced coding techniques.
 

Collectorchris

Well-Known Member
RPF PREMIUM MEMBER
I find myself in the same boat as the OP.
The last thing I learned to code was HTML in the late 90's/early 2000 when everyone wanted to build a website.
Knowing nothing of how to do anything with these as of yet, and since another system was mentioned, thoughts on Raspberry Pi? I also would like to be able to incorporate sound, don't know if Adruino is capable of doing this? or the difference in these.
 

xl97

Master Member
A RPi is basically a single board computer.

You can connect a mouse/keyboard and display to it... (and have a functional 'PC'.... with browser and surf the internet.etc..etc..etc)

* none of that can be done with an Arduino (in most cases at least)..

Arduino can NOT handle video.. but can handle minor audio itself.. or more audio capabilities with add-on boards or things like a DFPLayer board used in conjunction with an Arduino.

The Arduino scene, also has A LOT of add-on boards (referred to as 'shields') to expand the functionality of the core Arduino board... (GPS, SMS, Audio, Stepper motors.....etc..etc)

If you want to mess around with an RPI.. I suggest you know something about Linux and understand how the CLI (command line interface) works..

I would say its NOT for beginners, by any means. unless you following a tutorial where you just following someone else's process)

IMHO.. Arduino is where to start, because it starts you off with baby steps.. and as your needs/want expand.. then you explore how to expand your code to make these new things work.


Even if you dont know how to code.. looking at a basic 'sketch' (this is how 'code' is referred to in the Arduino world).... you will be able to understand the concepts.

Code:
digitalWrite(13, HIGH); 
delay(1000); 
digitalWrite(13, LOW); 
delay(1000);

Example above:

* turn pin 13 (has led connected to it) on
* wait 1000 miliseconds = (1 second)
* turn pin 13 (has led connected to it) off
* wait 1000 miliseconds = (1 second)


rinse repeat....
 
Last edited:

star-art

Sr Member
If you're new to programming, you might want to check out MicroPython. It's a "higher level" language that could be easier to understand for those who have never programmed before:

 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Top