![]() ![]() Therefore the DDB4 register bit will be logic ‘high’ or 1.ĭDRB |= (1 << PB4) // Set the pin PB4 as outputĬircuits Library - 220+ practical circuits PORTB register: ![]() Similarly we need to define the pin 3 or PB4 as an output pin. The below piece of code will do that.ĭDRB &= ~(1 << PB3) // Set the pin PB3 as input In order to make it as an Input we need to write the DDB3 register bit as logic ‘low’ or 0 in the code. Now according to the datasheet the pin 2 is PB3 of PORTB. We are looking to use pin 2 of attiny85 as Input. The configuration of ATtiny85 GPIO input pins starts with DDRB register, you can refer the datasheet here. The LED state will be toggled based on the button input. Here we will use a push button to feed signal to digital input pin and a LED as output. The second part of this series where we will explain how to configure its GPIO pins as input and how to read status of input pin. ![]() In the previous tutorial of ATtiny MCU series we have covered how to get started with this 8 bit MCU, Attiny85 and how to use its GPIO pin as an output. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |