LED blinking C program for Arduino

There are different ways you can write C program for blinking LED that is connected to Arduino. In this C programming tutorial for Arduino, we show couples of ways you can write the same thing- Blinking LED. This will give you idea of how Arduino UNO can be programmed using plain C programming language.

Here we show three different ways to write LED blinking C program for Arduino. As you perhaps know you can write program code for Arduino directly in plain C programming language instead of using Arduino based C++ programming language. In the tutorial How to program Arduino using ATMEL Studio 7 we showed you one way of writing LED blinking program in C and also how to use ATMEL Studio for compiling and uploading the code. Here we want to share couple of alternative C program code for blinking LED connected to Arduino UNO board. The pin used is the usual testing digital pin 13.

First LED blinking C program for Arduino UNO

Second LED blinking C program for Arduino UNO

Another way of writing this is to set the DDRB using hex number.


Third LED blinking C program for Arduino UNO

Yet another way of LED blinking is the following where PORTB = ~PORTB is used.

Choose any of the program above for simple LED blink test.

You can also write C program code for Arduino Due.

For Arduino Due see How to program Arduino Due using ATMEL Studio.

Leave a Reply

Your email address will not be published. Required fields are marked *