LED Blinking

Getting excited! about your first arduino program? OK! here you can do first:

  • Open the Arduino IDE (IDE with default functions) .
  • Click on File tab-> Examples-> Basics-> Blink(If you are absolute beginner or you want to save your efforts).
  • By Assigning PIN no. directly:

You can use PIN no. instead of LED_BUILTIN: PIN13 for builtin LED, but you can use any digital I/O pin for external LED circuit, which we will cover in later session. See example program:

  • By Declaring a variable to the PIN no:

Now we are using an Integer variable for PIN No. 13. The main advantage of declaring a name to the PIN No. is: we can change the PIN no. only at once, IDE replaces that variable name by PIN no., wherever used in the program during compilation.

  • By using directives:

In this method of declaration we use “# directive command” to declare PIN No. The “#define” directive is used to define values or macros that are used by the preprocessor to manipulate the program source code before it is compiled.

Leave a Reply