-2

I have an upcoming exam about the codes and stuff. Its about the basics like "blink with delay" and the "millis function". I need to get these things learned but i have no idea how?! Does anybody know a good site or how i can learn this?

4
  • Why don't you use the material your teacher provided you with? Or aren't there any sources? The ardiuno.cc site teaches you some basics arduino.cc/en/Tutorial/HomePage . But that's lot of stuff, so i would prefer the material from school. If you have an Arduino to use it, you can install the Arduino IDE and try some of the examples and learn from it. Commented Oct 24, 2020 at 10:34
  • Don't you mean "blink without delay"? The point is that the delay() function is to be avoided.
    – Duncan C
    Commented Oct 24, 2020 at 10:57
  • You should get an Arduino, a couple of LEDs, properly sized current limiting resistors, and spend a couple of days figuring out how to write a sketch that blinks the 2 LEDs at the same time on different intervals (Say you blink the first LED on and off every 3 seconds and the 2nd LED every 2 seconds.) If you figure that out, you will understand using millis() to manage timed events well enough for an exam.
    – Duncan C
    Commented Oct 24, 2020 at 10:59
  • There are tons of tutorials on the web about this (if you search for terms like "arduino blink without delay" or "arduino millis"). Even on this site the principle has been described numerous times. You should read some tutorials about it. If you don't have the actual Arduino hardware, you can use a simulator like from tinkercad. Try, what you have read in the tutorials and you will be able to figure this out fast.
    – chrisl
    Commented Oct 24, 2020 at 15:22

1 Answer 1

3

Learning to write code really takes practice - you learn far more by doing it than by reading about it. Start with the basic Blink example - search for a tutorial online if you want one, there are many - and get that running. Then play with it. Change the blink interval. Try adding a second LED, perhaps it turns off when the other turns on, for instance.

Every time you touch the code you'll have an "opportunity" to make a mistake or a typo. Fixing those will give you some insights you'll never get from reading about coding.

Once you've "squeezed all the juice" out of Blink, move on to Blink Without Delay. Run it, just as it is, at first. Than start tweaking it. Change one or both of the blinking periods. Again, try adding another LED with yet another blink rate.

These hands-on games are the best way to learn this stuff. Having someone (or Arduino Stack Exchange) who can help you when you're stuck is a great resource but the things you discover and the skills you acquire on your own when you fix your own mistakes are the ones that will stick with you (even 50 years later! ;-)

Not the answer you're looking for? Browse other questions tagged or ask your own question.