Is it possible to install a switch here?

Thread Starter

tobiwan123

Joined Jun 13, 2020
6
Hi, in the diagram there is a white switch responsible for the LED display sequence, is it possible to install a second switch responsible for another sequence so that it matches the diagram? If not, how can it be done then?
Zrzut ekranu (16).png
 

LesJones

Joined Jan 8, 2017
2,667
I think it should be possible to connect an extra switch to one of the unused I/O pins on the ATTINY85 You then just need to add the code to your program to check the state of that input and if the switch is closed select the code you have added to give the new sequence.

Les.
 

Thread Starter

tobiwan123

Joined Jun 13, 2020
6
You then just need to add the code to your program to check the state of that input and if the switch is closed select the code you have added to give the new sequence.
But can the microcontroller handle 2 programs seperately without selecting a chosen code in the process?
 

LesJones

Joined Jan 8, 2017
2,667
You don't have two programs. At some point in the existing program loop you add code to read the state of the I/O pin which is connected to your new switch. Then for example if the input is a logic zero you continue with the code of your existing program. If it is a logic one then you branch to you new code. Your new code must also be checking the state of the switch input so that yo can get back to the original code. You may even be able to use the existing code by changing the values that define delays. A lot depends on how the original code is written. If you have written the original code you will know exactly how it works.

Les.
 
Top