SHARE
TWEET

Untitled

NB52053 Jul 2nd, 2019 (edited) 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <mega32.h>
  2. #include<delay.h>
  3. // Declare your global variables here
  4. void main(void)
  5. {
  6. // Declare your local variables here
  7. DDRC = 0b00001111; // pin 3 of Port C is set as Output
  8. DDRB = 0b00000000; // pin 0, 1, 2, 3, 4, 5, 6, 7 of Port B is set as Input
  9. while (1)
  10. {
  11. // Place your code here
  12. if (PINB.5 == 0)
  13. {
  14. PORTC = 0b00001111; // pin 3 of Port C voltage is High
  15. delay_ms(200);
  16. }
  17. else
  18. {
  19. PORTC = 0b00000000; // pin 3 of Port C voltage is Low
  20. delay_ms(200);
  21. }
  22. }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top