luanpcs

Relatório 04

Jul 24th, 2021 (edited)
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. int main(void)
  2. {
  3.   DDRD = DDRD | 0b10000000;      // Pino PD7 definido como saída
  4.   PORTD = PORTD | 0b00010000;    // Habilitar resistor de PULL-UP no PD4
  5.   PORTD = PORTD & ~(0b10000000); // Desliga a saída PD7;
  6.   for (;;)
  7.   {
  8.     if ((PIND & 0b00010000) == 0) // Botão pressionado ?
  9.     {
  10.       PORTD = PORTD | 0b10000000; // Aciona a saída
  11.       _delay_ms(5000);
  12.       PORTD = PORTD & ~(0b10000000); // Desliga a saída
  13.     }
  14.   }
  15. }
Add Comment
Please, Sign In to add comment