Advertisement
RuiViana

Ohmimetro de Eletrodo

Feb 9th, 2016
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #include <LiquidCrystal.h> //Inclui a biblioteca do LCD
  2. LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  3. unsigned int amostra,Somatorio, 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;
  24. // Serial.print(mediaTotal);
  25. // Serial.print(" ");
  26. }
  27. mediaTotal= (mediaTotal/Medidas);
  28. lcd.setCursor(14,1);
  29. lcd.print(mediaTotal);
  30. delay(1000);
  31. // Serial.println(mediaTotal);
  32.  
  33. if (mediaTotal<=69)
  34. {
  35. lcd.setCursor(0,0);
  36. lcd.print(" ELETRODO ");
  37. lcd.setCursor(0,1);
  38. lcd.print("OK MUITO BOM! " );
  39. }
  40. if (mediaTotal>70)
  41. {
  42. lcd.setCursor(0,0);
  43. lcd.print(" ELETRODO ");
  44. lcd.setCursor(0,1);
  45. lcd.print(" OK + atencao! " );
  46. }
  47. if (mediaTotal>=105)
  48. {
  49. lcd.setCursor(0,0);
  50. lcd.print(" ELETRODO ");
  51. lcd.setCursor(0,1);
  52. lcd.print(" REPROVADO ");
  53. }
  54. mediaTotal = 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement