Reference code for noobs

Hi all
Just wondering if there are any sites that snippets of code that can be used in out sketches?

For example

Show code on how to repeat something x amount of times.
Or
Simple math stuff for working out rotation of gears and pully systems.

I know that forums are a great place for that but I feel guilty asking such dumb questions every other day.

For that particular item, look under the Arduino IDE: File/Examples/05. Control/ForLoopIteration

There are other good examples along the way.

For pulley/gear math, it rapidly gets into a combinatorial explosion of possibilities and there aren't ready-made examples. If you can already do the math on paper, translating it into C++ is sometimes straightforward. If you can't do the math on paper, not-quite-right code examples are probably going to confuse.

Dronebot Workshop on YouTube does E V E R Y T H I N G in a well-scripted way (in my opinion).

BV3D also has great Arduino "starter" information... (and 3D printing stuff)

1 Like

I shall take alook. Thank you

Do you own an Arduino Uno and a PC?

I do yes.

There is a built-in LED (L) on the UNO Board. Can you try to to find the Blink sketch from this path: IDE---> File---->Examples----->01.Basics---->Blink and upload it into UNO to continuously blink L?

After that modify the above program and upload the modified program to blink L only for 5 times at 2-sec interval. This exercise will serve you to observe how to repeat a process for x (here: x = 5) times.

1 Like

I don't think you'll find any one place with little blox of code that you could then use to construct your… whatever.

Learn the programming language features, those are the parts you need to string together to make algorithms.

You could work through the examples in the IDE. They are designed to show off one or the other language element, how they works and what they are useful for.

As for dumb questions, no one likes to ask (or answer) them.

So ask smarter questions after you've finally convinced yourself you just can't understand after reading some code that maybe you googled and found in a project similar to what you'd like to be able to do.

Or after you've wired up some parts and borrowed or written some code that you can't get going, either because it doesn't compile, or when it doesn't do what you thought.

Don't just run example code - study it, read it line by line and stop yourself and use your friend google to try to come to an understanding of the step by step nature of how these tiny programs get their jobs done.

As for learning the language, the internets are full of options. Google and give 5 to 10 different tutorials or video series or whatever 5 to 10 minutes each, to find a match to your level of knowledge at this point and whether you like the style and pace of the material and, if there is one, the presenter.

a7

You could go old school and get a book .
Simon Monk has a couple of good ones

Nice one thanks. Iv decided to watch soon tutorials on youtube. As my codeing skills suck lol.

Dave

So do a lot of the YouTubers who post "tutorials"

Oh,

Keep in mind that like nowhere else, in programming spelling counts.

a7

Have you installed IDE 1.8.19 or later in your PC? If yes, then can you open the IDE/blank sketch (Fig-1) by clicking on the this icon : arduinoIcon located on the Desktop of your PC?

The IDE/blank sketch
blankSketch
Figure-1:

Hey, just like bad content "out there," there is bad content "in here." You will be okay watching some videos to see their work. The two I mentioned are thorough (BVD3D walks you through start to finish) and entertaining. Have fun in your discoveries.

1 Like

iv already watched a few BV3d vids and DroneBot. very interesting and informative.

I have to say. After my rough start when I 1st asked for help a few weeks ago now. I'm finding this forum a very pleasant place to ask question and help.

thank you all very much.

Best Regards

Dave

: )

To(o) many of us understand this, but continuing, you ARE right. It is a very pleasant place to learn fun stuff. Good luck.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.