Code your Arduino using Assembly language - Dwell deeper and learn the nut and bolts of standard blink LED example
Assembly coding lets you talk to the Microcontroller's bare metal. You will be in charge of everything (from declaring heap, stack and RAM etc). Assembly instructions also execute faster. The compilation time will be less. In this project, we will see how to blink an LED using assembly programming alone.
Assembly code for Blink LED
; Blink LED on PB5(Arduino Uno pin 13)
#define __SFR_OFFSET 0
sbi DDRB, 5 ; Set PB5 as output
sbi PINB, 5 ; Toggle PINB
ldi r25, hi8(1000)
ldi r24, lo8(1000)
; Delay about (r25:r24)*ms. Clobbers r30, and r31.
; One millisecond is about 16000 cycles at 16MHz.
; The inner loop takes 4 cycles, so we repeat it 3000 times
ldi r31, hi8(4000)
ldi r30, lo8(4000)
sbiw r30, 1
sbiw r24, 1
To learn about programming, the following challenges can be taken by you. Once you complete the project please post the link in the comments. I will be glad to add them as well in the article if they are working.
- Change the code to blink the LED every two seconds once
- Change the code so that LED will be ON for 200 ms and OFF for 1000 ms
Link to the project
Other examples on free Arduino simulator
Tiny4kOLED on ATTiny85 enables you to drive an OLED display using ATTiny85 and an OLED SSD1306 display.
Servo motor driving is a very helpful skill. Play with the Arduino simulator, tweak your logic, tinker with the code all for free on the wokwi Arduino simulator
A comparison between Tinkercad simulator versus wokwi Arduino simulator
a collection of the project on the wokwi Arduino simulator
A bit about Wokwi Arduino Simulator
Arduino simulators help cut the learning time. They help in presenting your project to others very easily. You can easily share the code with others. Hardware hurdles such as hardware not available, or faulty USB cables etc won't slowdown you. Also, it will save time and money especially when you experiment with your code and projects. The simulator from wokwi comes with all the benefits.
you can visit https://wokwi.com to learn Arduino faster and free!