Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * t13-tlacitko-rele.c
- *
- * Created: 07.05.2020 12:53:28
- * Author : martin
- */
- #include <avr/io.h>
- #define RELE_ON PORTB|=(1<<PB0);
- #define RELE_OFF PORTB&=~(1<<PB0);
- uint8_t stateTl=0;
- uint8_t stateOut=0;
- int main(void)
- {
- DDRB|=(1<<PB0); // PB0 - vystup
- PORTB|=(1<<PB2); // PB2 vstup proti zemi
- while (1)
- {
- if (!(PINB&(1<<PB2)) && stateTl==1)
- {
- stateTl=0;
- if (stateOut)
- { stateOut=0; RELE_OFF;}
- else
- { stateOut=1; RELE_ON; }
- }
- if (PINB&(1<<PB2)) stateTl=1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement