Tutoriais do microcontrolador ATtiny85, Parte 4: LED Chaser usando ATtiny85

ATtiny85 Microcontroller Tutorials Part 4: LED Chaser Using ATtiny85

In the previous tutorial in this series, we saw how to work with ATtiny85, how to program it, and we also built our first – hello world app – which is an LED blinking app using ATtiny85.

So let's extend it to the next step – meaning one step forward. We will connect 5 LEDs with 5 port pins of ATtiny85 and generate different chasing effects. Five LEDs of different colors are connected to the ATtiny85, and it will flash them in a different pattern at a different rate, creating eye-catching multi-color chasing effects. So let's see how to do this.

If you are not following this tutorial series from the beginning, you will be prompted to follow the following two tutorials that explain and demonstrate how to work with ATtiny85 and a step-by-step guide to building a Hello World (Blinking LED) app.
How to work with ATtiny85
LED blinking using ATtiny85

Circuit Diagram

Circuit Connections
As you can see, 5 LEDs of different colors are connected to 5 port pins of the ATtiny85. The anodes of the LEDs are connected to the PORTB pins PB0 (pin 5), PB1 (pin 6), PB2 (pin 7), PB3 (pin 2), PB4 (pin 3) through 330Ω current limiting resistors. All the cathodes of the LED are connected to pin 4, which is the Gnd pin. A 5V supply is connected to a Vcc pin (8)

Program
The program is written in Arduino IDE software using the C programming language. It is compiled and a HEX file is created that is downloaded to the ATtiny85's internal FLASH.

Program logic
The program logic is straightforward. The program generates 3 different chase effects. Each effect lasts 50-60 seconds (approximately 1 min) and repeats one after the other continuously as effect1 – effect2 – effect3 – effect1 – effect2 –…..

The first effect is the simplest. Each LED flashes in sequence from led1 to led 5.

In the second effect, one by one, all LEDs are lit from led1 to led5, and then all are turned off in the reverse sequence from led5 to led1.

In the third effect, the alternating LED is ON and OFF means led1-led3-led5 are ON and led2-led4 are OFF, and after the delay, led1-led3-led5 are OFF and led2-led4 are ON.

In the next tutorial we will learn how to vary the LED brightness.

Conteúdo Relacionado

What is the role of automotive sensors in modern vehicles?
A network of sensors is embedded in every vehicle,...
How to choose an e-bike controller
The motor controller is one of the most important...
How to Troubleshoot Common ESP32-CAM Problems
ESP32-CAM is a compact camera module that combines the...
A guide to USB standards from 1.0 to USB4
A evolução dos padrões USB foi fundamental para moldar...
Schurter aprimora série de seletores de tensão com revestimento prateado
A SCHURTER anuncia um aprimoramento para sua conhecida série...
A interface serial PCI fornece conectividade confiável em ambientes extremos
A Sealevel Systems anuncia o lançamento da Interface Serial...
STMicroelectronics expande portfólio de conversão de energia com diodos Trench Schottky de 100 V
A STMicroelectronics introduziu Diodos retificadores Schottky de trincheira de...
O que são Sistemas Globais de Navegação por Satélite (GNSS) e como são usados?
Determinar uma localização precisa é necessário em várias indústrias...
O conversor GaN de 50 W da STMicroelectronics permite projetos de energia de alta eficiência
O novo VIPerGaN50 da STMicroelectronics simplifica a construção de...
Samsung e Red Hat farão parceria em software de memória de próxima geração
A Samsung Electronics, fornecedora de tecnologia de memória avançada,...
Primeiro MPU single-core com interface de câmera MIPI CSI-2 e áudio
O mercado embarcado tem uma necessidade de soluções de...
Fluency decoding in induction motor for better performance
You have probably come across the term ' drag...
Understanding Support Insulators in Electrical Systems
You probably have a support insulator if you've noticed...
Explore Stay Insulator – safety, installation and maintenance
You've probably seen stand an insulator sit on power...
More safety and efficiency with the shackle isolator
You've probably seen shackle insulators enthroned on electricity poles,...
Discover the power of latching relays for energy efficiency and more
You have probably experienced situations where controlling a circuit...
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.