Advertisement
RuiViana

New_Ohm

Feb 9th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #include <LiquidCrystal.h> //Inclui a biblioteca do LCD
  2. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  3. float amostra, mediaTotal;
  4. unsigned int Medidas = 5;
  5.  
  6. //-------------------------------------------------------
  7. void setup()
  8. {
  9. Serial.begin(9600);
  10. lcd.begin(16, 2);
  11. lcd.setCursor(0, 0);
  12. lcd.print(" FAM-LTDA ");
  13. lcd.setCursor(0, 1);
  14. lcd.print("AGUARDANDO");
  15. }
  16. //----------------------------------------------------
  17. void loop()
  18. {
  19. for (int i = 0 ; i < Medidas ; i++)
  20. {
  21. amostra=analogRead (0);
  22. delay (10);
  23. mediaTotal = mediaTotal + (amostra*11/10);
  24. }
  25. mediaTotal= (mediaTotal/Medidas);
  26. lcd.setCursor(0,0);
  27. lcd.print(" ELETRODO ");
  28. // Serial.println(int(mediaTotal));
  29.  
  30. if (mediaTotal<=69)
  31. {
  32. lcd.setCursor(0,1);
  33. lcd.print("OK MUITO BOM! " );
  34. lcd.print(int(mediaTotal));
  35. lcd.print(" ");
  36. }
  37. if (mediaTotal>70)
  38. {
  39. lcd.setCursor(0,1);
  40. lcd.print("OK + atencao!");
  41. lcd.print(int(mediaTotal));
  42. lcd.print(" ");
  43. }
  44. if (mediaTotal>=105)
  45. {
  46. lcd.setCursor(0,1);
  47. lcd.print(" REPROVADO ");
  48. lcd.print(int(mediaTotal));
  49. lcd.print(" ");
  50. }
  51. delay(1000);
  52. mediaTotal = 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement