Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2.  
  3. LiquidCrystal lcd(12,11,5,4,3,2);
  4. int I_vo_re = A0;
  5. int I_vo_li = A1;
  6. int I_hi_re = A2;
  7. int I_hi_li = A3;
  8.  
  9. float x1r = 0;
  10. float x2r = 0;
  11. float x3r = 0;
  12. float x4r = 0;
  13.  
  14. void setup() {
  15.  
  16. lcd.begin(16,2);
  17. Serial.begin(9600);
  18.  
  19. pinMode(I_vo_re, INPUT);
  20. pinMode(I_vo_li, INPUT);
  21. pinMode(I_hi_re, INPUT);
  22. pinMode(I_hi_li, INPUT);
  23. }
  24.  
  25. void loop() {
  26.  
  27. float x1 = analogRead(I_vo_li);
  28. float x2 = analogRead(I_vo_re);
  29. float x3 = analogRead(I_hi_re);
  30. float x4 = analogRead(I_hi_li);
  31. x1r = 0.8 * x1r + 0.2 * analogRead(I_vo_li);
  32. x2r = 0.8 * x2r + 0.2 * analogRead(I_vo_re);
  33. x3r = 0.8 * x3r + 0.2 * analogRead(I_hi_li);
  34. x4r = 0.8 * x4r + 0.2 * analogRead(I_hi_re);
  35.  
  36. lcd.setCursor(0,0);
  37. lcd.print(x1r/100);
  38. lcd.setCursor(8,0);
  39. lcd.print(x2/100);
  40. lcd.setCursor(8,2);
  41. lcd.print(x3/100);
  42. lcd.setCursor(0,2);
  43. lcd.print(x4/100);
  44. lcd.setCursor(4,0);
  45. lcd.print("bar");
  46. lcd.setCursor(12,0);
  47. lcd.print("bar");
  48. lcd.setCursor(4,2);
  49. lcd.print("bar");
  50. lcd.setCursor(12,2);
  51. lcd.print("bar");
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement