Advertisement
Guest User

Code

a guest
Sep 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /*
  2. * BasicIO1.c
  3. *
  4. * Created: 9/11/2016 11:54:18 AM
  5. * Author : Alin
  6. */
  7.  
  8.  
  9.  
  10. #define F_CPU 16000000UL
  11.  
  12. #include <stdio.h>
  13. #include <avr/io.h>
  14. #include <util/delay.h>
  15. #include "usart.h"
  16.  
  17. int main(void) {
  18.  
  19. uart_init(); // open the communication to the microcontroller
  20. io_redirect(); // redirect input and output to the uart
  21.  
  22. int input = 0;
  23. int max = -INFINITY;
  24. int min = INFINITY;
  25.  
  26. while(1) {
  27.  
  28. printf("Input Temperature\n");
  29. scanf("%d", &input);
  30. if (input > max)
  31. max = input;
  32. if (input < min)
  33. min = input;
  34. printf ("Max = %d", max);
  35. printf(" Min = %d", min);
  36. printf(" Current = %d\n", input);
  37. printf("\n");
  38. }
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement