Advertisement
Guest User

Untitled

a guest
Apr 28th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5.  
  6. #include <avr/io.h>
  7. #include <avr/interrupt.h>
  8. #include <util/delay.h>
  9.  
  10. int main (void)
  11. {
  12.   DDRA &= ~_BV(PA0); /* PA0=input. */
  13.  
  14.   DDRC |= _BV(PC5); /* PC5=output. */
  15.  
  16.   if (PINA & _BV(PA0)) /* read PA0 */
  17.   {
  18.       PORTC |= _BV(PC5); /* write PC5=1 */
  19.   }
  20.   else
  21.   {
  22.       PORTC &= ~_BV(PC5); /* write PC5=0 */
  23.   }
  24.  
  25.   return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement