Advertisement
Krejzi_Dark

Untitled

Feb 17th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 16.84 KB | None | 0 0
  1. #define relay1 14
  2. #define highPin1 A0
  3. #define lowPin1 A1
  4.  
  5. #define relay2 16
  6. #define highPin2 A2
  7. #define lowPin2 A3
  8.  
  9. #define relay3 15
  10. #define highPin3 A6
  11. #define lowPin3 A7
  12.  
  13. #define relay4 5
  14. #define highPin4 A8
  15. #define lowPin4 A9
  16.  
  17. #include <Adafruit_SSD1306.h>
  18. #define OLED_RESET 1
  19. Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);
  20.  
  21. #include <Adafruit_NeoPixel.h>
  22. #ifdef __AVR__
  23.   #include <avr/power.h>
  24. #endif
  25.  
  26. #define PIN            0
  27. #define NUMPIXELS      4
  28.  
  29. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
  30.  
  31. #define BUT1 7
  32. int menu;
  33.  
  34. int interwal = 1000;
  35.  
  36. int a = 0;
  37. int b = 0;
  38. int c = 0;
  39. int d = 0;
  40.  
  41. float napRef = 5.06;
  42. float napEnd_1_5V = 0.9;
  43. float napEnd_4_2V = 2.7;
  44. float rezystancja = 11.0;
  45.  
  46. boolean koniec1;
  47. float mAh1 = 0.0;
  48. float mAh1_3;
  49. float prad1 = 0.0;
  50. float prad1_3;
  51. float battVolt1 = 0.0;
  52. float battVolt1_1;
  53. float battVolt1_2;
  54. float battVolt1_3;
  55. float shuntVolt1 = 0.0;
  56. float battLow1 = 0.0;
  57. int rw1;
  58. String rw11;
  59.  
  60. boolean koniec2;
  61. float mAh2 = 0.0;
  62. float mAh2_3;
  63. float prad2 = 0.0;
  64. float prad2_3;
  65. float battVolt2 = 0.0;
  66. float battVolt2_1;
  67. float battVolt2_2;
  68. float battVolt2_3;
  69. float shuntVolt2 = 0.0;
  70. float battLow2 = 0.0;
  71. int rw2;
  72. String rw22;
  73.  
  74. boolean koniec3;
  75. float mAh3 = 0.0;
  76. float mAh3_3;
  77. float prad3 = 0.0;
  78. float prad3_3;
  79. float battVolt3 = 0.0;
  80. float battVolt3_1;
  81. float battVolt3_2;
  82. float battVolt3_3;
  83. float shuntVolt3 = 0.0;
  84. float battLow3 = 0.0;
  85. int rw3;
  86. String rw33;
  87.  
  88. boolean koniec4;
  89. float mAh4 = 0.0;
  90. float mAh4_3;
  91. float prad4 = 0.0;
  92. float prad4_3;
  93. float battVolt4 = 0.0;
  94. float battVolt4_1;
  95. float battVolt4_2;
  96. float battVolt4_3;
  97. float shuntVolt4 = 0.0;
  98. float battLow4 = 0.0;
  99. int rw4;
  100. String rw44;
  101.  
  102. unsigned long previousMillis1 = 0;
  103. unsigned long millisPassed1 = 0;
  104.  
  105. unsigned long previousMillis2 = 0;
  106. unsigned long millisPassed2 = 0;
  107.  
  108. unsigned long previousMillis3 = 0;
  109. unsigned long millisPassed3 = 0;
  110.  
  111. unsigned long previousMillis4 = 0;
  112. unsigned long millisPassed4 = 0;
  113.  
  114. String rw_ex = "       EXCELENT";
  115. String rw_good = "         GOOD";
  116. String rw_suf = "     SUFFICIENT";
  117. String rw_low = "         LOW";
  118. String rw_bad = "         BAD";
  119.  
  120. void przycisk()
  121. {
  122.   if (digitalRead(BUT1) == LOW)
  123.   {
  124.     delay(100);
  125.     menu ++;
  126.     if (menu > 2) menu = 1;
  127.   }
  128. }
  129.  
  130. void setup()
  131. {
  132.   pinMode(relay1, OUTPUT);
  133.   pinMode(relay2, OUTPUT);
  134.   pinMode(relay3, OUTPUT);
  135.   pinMode(relay4, OUTPUT);
  136.   pinMode(BUT1, INPUT_PULLUP);
  137.   display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  138.   display.clearDisplay();
  139.   display.display();
  140.  
  141.   display.setTextSize(1);
  142.   display.setTextColor(SSD1306_WHITE);
  143.  
  144.   display.println("");
  145.   display.println("        Tester");
  146.   display.println("      pojemnosci");
  147.   display.println("        ogniw");
  148.   display.display();
  149.   delay(1000);
  150.  
  151.   pixels.begin();
  152.   menu = 2;
  153. }
  154.  
  155. void loop() {
  156.   przycisk();
  157.   menu ++;
  158.   if (menu > 2) menu = 1;
  159.   battVolt1 = analogRead(highPin1) * napRef / 1024.0;
  160.   shuntVolt1 = analogRead(lowPin1) * napRef / 1024.0;
  161.  
  162.   battVolt2 = analogRead(highPin2) * napRef / 1024.0;
  163.   shuntVolt2 = analogRead(lowPin2) * napRef / 1024.0;
  164.  
  165.   battVolt3 = analogRead(highPin3) * napRef / 1024.0;
  166.   shuntVolt3 = analogRead(lowPin3) * napRef / 1024.0;
  167.  
  168.   battVolt4 = analogRead(highPin4) * napRef / 1024.0;
  169.   shuntVolt4 = analogRead(lowPin4) * napRef / 1024.0;
  170.  
  171.   if (battVolt1 <= 4.3 && battVolt1 > battLow1) a++;
  172.   if (battVolt1 <= battLow1 && battVolt1 > 0.2) a = 1;
  173.   if (battVolt1 <= 0.2) a = 0;
  174.  
  175.   if (battVolt2 <= 4.3 && battVolt2 > battLow2) b++;
  176.   if (battVolt2 <= battLow2 && battVolt2 > 0.2) b = 1;
  177.   if (battVolt2 <= 0.2) b = 0;
  178.  
  179.   if (battVolt3 <= 4.3 && battVolt3 > battLow3) c++;
  180.   if (battVolt3 <= battLow3 && battVolt3 > 0.2) c = 1;
  181.   if (battVolt3 <= 0.2) c = 0;
  182.  
  183.   if (battVolt4 <= 4.3 && battVolt4 > battLow4) d++;
  184.   if (battVolt4 <= battLow4 && battVolt4 > 0.2) d = 1;
  185.   if (battVolt4 <= 0.2) d = 0;
  186.  
  187.   if (a == 0)
  188.   {
  189.     pixels.setPixelColor(0, pixels.Color(0,0,250));
  190.     digitalWrite(relay1, LOW);
  191.     battVolt1 = 0;
  192.     battVolt1_1 = 0;
  193.     battVolt1_2 = 0;
  194.     battLow1 = 0;
  195.     prad1 = 0;
  196.     mAh1 = 0;
  197.     shuntVolt1 = 0;
  198.     rw1=0;
  199.     koniec1 = false;
  200.   }
  201.  
  202.   if (a == 2)
  203.   {
  204.     if(battVolt1 >= 2.7) battLow1 = napEnd_4_2V;
  205.     if(battVolt1 < 2.7) battLow1 = napEnd_1_5V;
  206.     battVolt1_1 = battVolt1;
  207.   }
  208.  
  209.   if (a == 22)
  210.   {
  211.     battVolt1_2 = battVolt1;
  212.   }
  213.  
  214.   if (b == 0)
  215.   {
  216.     pixels.setPixelColor(1, pixels.Color(0,0,250));
  217.     digitalWrite(relay2, LOW);
  218.     battVolt2 = 0;
  219.     battVolt2_1 = 0;
  220.     battVolt2_2 = 0;
  221.     battLow2 = 0;
  222.     prad2 = 0;
  223.     mAh2 = 0;
  224.     shuntVolt2 = 0;
  225.     rw2=0;
  226.     koniec2 = false;
  227.   }
  228.  
  229.   if (b == 2)
  230.   {
  231.     if(battVolt2 >= 2.7) battLow2 = napEnd_4_2V;
  232.     if(battVolt2 < 2.7) battLow2 = napEnd_1_5V;
  233.     battVolt2_1 = battVolt2;
  234.   }
  235.  
  236.   if (b == 22)
  237.   {
  238.     battVolt2_2 = battVolt2;
  239.   }
  240.  
  241.   if (c == 0)
  242.   {
  243.     pixels.setPixelColor(2, pixels.Color(0,0,250));
  244.     digitalWrite(relay3, LOW);
  245.     battVolt3 = 0;
  246.     battVolt3_1 = 0;
  247.     battVolt3_2 = 0;
  248.     battLow3 = 0;
  249.     prad3 = 0;
  250.     mAh3 = 0;
  251.     shuntVolt3 = 0;
  252.     rw3=0;
  253.     koniec3 = false;
  254.   }
  255.  
  256.   if (c == 2)
  257.   {
  258.     if(battVolt3 >= 2.7) battLow3 = napEnd_4_2V;
  259.     if(battVolt3 < 2.7) battLow3 = napEnd_1_5V;
  260.     battVolt3_1 = battVolt3;
  261.   }
  262.  
  263.   if (c == 22)
  264.   {
  265.     battVolt3_2 = battVolt3;
  266.   }
  267.  
  268.   if (d == 0)
  269.   {
  270.     pixels.setPixelColor(3, pixels.Color(0,0,250));
  271.     digitalWrite(relay4, LOW);
  272.     battVolt4 = 0;
  273.     battVolt4_1 = 0;
  274.     battVolt4_2 = 0;
  275.     battLow4 = 0;
  276.     prad4 = 0;
  277.     mAh4 = 0;
  278.     shuntVolt4 = 0;
  279.     rw4=0;
  280.     koniec4 = false;
  281.   }
  282.  
  283.   if (d == 2)
  284.   {
  285.     if(battVolt4 >= 2.7) battLow4 = napEnd_4_2V;
  286.     if(battVolt4 < 2.7) battLow4 = napEnd_1_5V;
  287.     battVolt4_1 = battVolt4;
  288.   }
  289.  
  290.   if (d == 22)
  291.   {
  292.     battVolt4_2 = battVolt4;
  293.   }
  294.  
  295.   if(battVolt1 >= 0.2)
  296.   {
  297.     millisPassed1 = millis() - previousMillis1;
  298.     prad1 = (battVolt1 - shuntVolt1) / rezystancja;
  299.     if (prad1 <= 0.00) prad1 = 0.00;
  300.     mAh1 = mAh1 + (prad1 * 1000.0) * (millisPassed1 / 3600000.0);  
  301.     rw1 = ((battVolt1_1 * rezystancja) - (battVolt1_2 * rezystancja)) / battVolt1_2 * 1000;
  302.     previousMillis1 = millis();
  303.   }
  304.  
  305.   if(battVolt1 < battLow1)
  306.   {
  307.  
  308.     koniec1 = true;
  309.     battVolt1_3 = battVolt1;
  310.     prad1_3 = prad1;
  311.     mAh1_3 = mAh1;
  312.   }
  313.  
  314.   if(battVolt2 >= 0.2)
  315.   {
  316.     millisPassed2 = millis() - previousMillis2;
  317.     prad2 = (battVolt2 - shuntVolt2) / rezystancja;
  318.     if (prad2 <= 0.00) prad2 = 0.00;
  319.     mAh2 = mAh2 + (prad2 * 1000.0) * (millisPassed2 / 3600000.0);  
  320.     rw2 = ((battVolt2_1 * rezystancja) - (battVolt2_2 * rezystancja)) / battVolt2_2 * 1000;
  321.     previousMillis2 = millis();
  322.   }
  323.  
  324.   if(battVolt2 < battLow2)
  325.   {
  326.  
  327.     koniec2 = true;
  328.     battVolt2_3 = battVolt2;
  329.     prad2_3 = prad2;
  330.     mAh2_3 = mAh2;    
  331.   }
  332.  
  333.   if(battVolt3 >= 0.2)
  334.   {
  335.     millisPassed3 = millis() - previousMillis3;
  336.     prad3 = (battVolt3 - shuntVolt3) / rezystancja;
  337.     if (prad3 <= 0.00) prad3 = 0.00;
  338.     mAh3 = mAh3 + (prad3 * 1000.0) * (millisPassed3 / 3600000.0);  
  339.     rw3 = ((battVolt3_1 * rezystancja) - (battVolt3_2 * rezystancja)) / battVolt3_2 * 1000;
  340.     previousMillis3 = millis();
  341.   }
  342.  
  343.   if(battVolt3 < battLow3)
  344.   {
  345.  
  346.     koniec3 = true;
  347.     battVolt3_3 = battVolt3;
  348.     prad3_3 = prad3;
  349.     mAh3_3 = mAh3;    
  350.   }
  351.  
  352.   if(battVolt4 >= 0.2)
  353.   {
  354.     millisPassed4 = millis() - previousMillis4;
  355.     prad4 = (battVolt4 - shuntVolt4) / rezystancja;
  356.     if (prad4 <= 0.00) prad4 = 0.00;
  357.     mAh4 = mAh4 + (prad4 * 1000.0) * (millisPassed4 / 3600000.0);  
  358.     rw4 = ((battVolt4_1 * rezystancja) - (battVolt4_2 * rezystancja)) / battVolt4_2 * 1000;
  359.     previousMillis4 = millis();
  360.   }
  361.  
  362.   if(battVolt4 < battLow4)
  363.   {
  364.    
  365.     koniec4 = true;
  366.     battVolt4_3 = battVolt4;
  367.     prad4_3 = prad4;
  368.     mAh4_3 = mAh4;    
  369.   }
  370.  
  371.   delay(interwal);
  372.   display.clearDisplay();
  373.  
  374. if (koniec1 == false && a > 0)
  375. {
  376.   pixels.setPixelColor(0, pixels.Color(0,250,0));
  377.   if (a > 3) digitalWrite(relay1, HIGH);
  378. }
  379. if (koniec1 == true)
  380. {
  381.   pixels.setPixelColor(0, pixels.Color(250,0,0));
  382.   digitalWrite(relay1, LOW);
  383. }
  384.  
  385. if (koniec2 == false && b > 0)
  386. {
  387.   pixels.setPixelColor(1, pixels.Color(0,250,0));
  388.   if (b > 3) digitalWrite(relay2, HIGH);
  389. }
  390. if (koniec2 == true)
  391. {
  392.   pixels.setPixelColor(1, pixels.Color(250,0,0));
  393.   digitalWrite(relay2, LOW);
  394. }
  395.  
  396. if (koniec3 == false && c > 0)
  397. {
  398.   pixels.setPixelColor(2, pixels.Color(0,250,0));
  399.   if (c > 3) digitalWrite(relay3, HIGH);
  400. }
  401. if (koniec3 == true)
  402. {
  403.   pixels.setPixelColor(2, pixels.Color(250,0,0));
  404.   digitalWrite(relay3, LOW);
  405. }
  406.  
  407. if (koniec4 == false && d > 0)
  408. {
  409.   pixels.setPixelColor(3, pixels.Color(0,250,0));
  410.   if (d > 3) digitalWrite(relay4, HIGH);
  411. }
  412. if (koniec4 == true)
  413. {
  414.   pixels.setPixelColor(3, pixels.Color(250,0,0));
  415.   digitalWrite(relay4, LOW);
  416. }
  417.  
  418. if (rw1 > 0 && rw1 <= 150) rw11 = rw_ex;
  419. if (rw1 > 150 && rw1 <= 250) rw11 = rw_good;
  420. if (rw1 > 250 && rw1 <= 350) rw11 = rw_suf;
  421. if (rw1 > 350 && rw1 <= 500) rw11 = rw_low;
  422. if (rw1 >= 500 ) rw11 = rw_bad;
  423.  
  424. if (rw2 > 0 && rw2 <= 150) rw22 = rw_ex;
  425. if (rw2 > 150 && rw2 <= 250) rw22 = rw_good;
  426. if (rw2 > 250 && rw2 <= 350) rw22 = rw_suf;
  427. if (rw2 > 350 && rw2 <= 500) rw22 = rw_low;
  428. if (rw2 >= 500 ) rw22 = rw_bad;
  429.  
  430. if (rw3 > 0 && rw3 <= 150) rw33 = rw_ex;
  431. if (rw3 > 150 && rw3 <= 250) rw33 = rw_good;
  432. if (rw3 > 250 && rw3 <= 350) rw33 = rw_suf;
  433. if (rw3 > 350 && rw3 <= 500) rw33 = rw_low;
  434. if (rw3 >= 500 ) rw33 = rw_bad;
  435.  
  436. if (rw4 > 0 && rw4 <= 150) rw44 = rw_ex;
  437. if (rw4 > 150 && rw4 <= 250) rw44 = rw_good;
  438. if (rw4 > 250 && rw4 <= 350) rw44 = rw_suf;
  439. if (rw4 > 350 && rw4 <= 500) rw44 = rw_low;
  440. if (rw4 >= 500 ) rw44 = rw_bad;
  441.  
  442. switch (menu)
  443. {
  444.   case 1:
  445.   if (a == 0)
  446.   {
  447.     display.setCursor(0, 0);
  448.     display.println("Ogniwo 1         BRAK");
  449.     display.println("");
  450.     display.println("    Umiesc ogniwo");
  451.     display.println("     w gniezdzie");
  452.   }
  453.  
  454.   if (koniec1 == false && a > 0)
  455.   {
  456.     display.setCursor(0, 0);
  457.     display.print("Ogniwo 1");
  458.     if (battLow1 == 2.7) display.println("         4.2V");
  459.     if (battLow1 == 0.9) display.println("         1.5V");
  460.     display.println("");
  461.    
  462.     display.print("U: "); display.print(battVolt1); display.print("V        "); display.print(battVolt1_1); display.println("V");
  463.     display.print("I: "); display.print(prad1); display.print("A        ");display.print(battLow1); display.println("V");
  464.     display.println("");
  465.      
  466.     display.print(mAh1); display.println("mAh");
  467.    
  468.     if (battVolt1_2 > 0)
  469.     {
  470.       if (rw1 > 0)
  471.       {
  472.         display.print("Rw: ");
  473.         display.print(rw1);
  474.         display.println("mOhm");
  475.       }
  476.       display.print(rw11);
  477.     }
  478.   }
  479.  
  480.   if (koniec1 == true)
  481.   {
  482.     display.setCursor(0, 0);
  483.     display.print("Ogniwo 1");
  484.     if (battLow1 == 2.7) display.println("         4.2V");
  485.     if (battLow1 == 0.9) display.println("         1.5V");
  486.     display.println("         KONIEC");
  487.    
  488.     display.print("U: "); display.print(battVolt1_3); display.print("V        "); display.print(battVolt1_1); display.println("V");
  489.     display.print("I: "); display.print(prad1_3); display.print("A        ");display.print(battLow1); display.println("V");
  490.     display.println("");
  491.      
  492.     display.print(mAh1); display.println("mAh");
  493.    
  494.    
  495.     if (rw1 > 0)
  496.     {
  497.       display.print("Rw: ");
  498.       display.print(rw1);
  499.       display.println("mOhm");
  500.     }
  501.     display.print(rw11);
  502.   }
  503.   break;
  504.  
  505.   case 2:
  506.   if (b == 0)
  507.   {
  508.     display.setCursor(0, 0);
  509.     display.println("Ogniwo 2         BRAK");
  510.     display.println("");
  511.     display.println("    Umiesc ogniwo");
  512.     display.println("     w gniezdzie");
  513.   }
  514.  
  515.   if (koniec2 == false && b > 0)
  516.   {
  517.     display.setCursor(0, 0);
  518.     display.print("Ogniwo 2");
  519.     if (battLow2 == 2.7) display.println("         4.2V");
  520.     if (battLow2 == 0.9) display.println("         1.5V");
  521.     display.println("");
  522.    
  523.     display.print("U: "); display.print(battVolt2); display.print("V        "); display.print(battVolt2_1); display.println("V");
  524.     display.print("I: "); display.print(prad2); display.print("A        ");display.print(battLow2); display.println("V");
  525.     display.println("");
  526.      
  527.     display.print(mAh2); display.println("mAh");
  528.    
  529.     if (battVolt2_2 > 0)
  530.     {
  531.       if (rw2 > 0)
  532.       {
  533.         display.print("Rw: ");
  534.         display.print(rw2);
  535.         display.println("mOhm");
  536.       }
  537.       display.print(rw22);
  538.     }
  539.   }
  540.  
  541.   if (koniec2 == true)
  542.   {
  543.     display.setCursor(0, 0);
  544.     display.print("Ogniwo 2");
  545.     if (battLow2 == 2.7) display.println("         4.2V");
  546.     if (battLow2 == 0.9) display.println("         1.5V");
  547.     display.println("         KONIEC");
  548.    
  549.     display.print("U: "); display.print(battVolt2_3); display.print("V        "); display.print(battVolt2_1); display.println("V");
  550.     display.print("I: "); display.print(prad2_3); display.print("A        ");display.print(battLow2); display.println("V");
  551.     display.println("");
  552.      
  553.     display.print(mAh2); display.println("mAh");
  554.    
  555.      
  556.     if (rw2 > 0)
  557.     {
  558.       display.print("Rw: ");
  559.       display.print(rw2);
  560.       display.println("mOhm");
  561.     }
  562.     display.print(rw22);
  563.   }
  564.   break;
  565.  
  566.   case 3:
  567.   if (c == 0)
  568.   {
  569.     display.setCursor(0, 0);
  570.     display.println("Ogniwo 3         BRAK");
  571.     display.println("");
  572.     display.println("    Umiesc ogniwo");
  573.     display.println("     w gniezdzie");
  574.   }
  575.  
  576.   if (koniec3 == false && c > 0)
  577.   {
  578.     display.setCursor(0, 0);
  579.     display.print("Ogniwo 3");
  580.     if (battLow3 == 2.7) display.println("         4.2V");
  581.     if (battLow3 == 0.9) display.println("         1.5V");
  582.     display.println("");
  583.    
  584.     display.print("U: "); display.print(battVolt3); display.print("V        "); display.print(battVolt3_1); display.println("V");
  585.     display.print("I: "); display.print(prad3); display.print("A        ");display.print(battLow3); display.println("V");
  586.     display.println("");
  587.      
  588.     display.print(mAh3); display.println("mAh");
  589.    
  590.     if (battVolt3_2 > 0)
  591.     {
  592.       if (rw3 > 0)
  593.       {
  594.         display.print("Rw: ");
  595.         display.print(rw3);
  596.         display.println("mOhm");
  597.       }
  598.       display.print(rw33);
  599.     }
  600.   }
  601.  
  602.   if (koniec3 == true)
  603.   {
  604.     display.setCursor(0, 0);
  605.     display.print("Ogniwo 3");
  606.     if (battLow3 == 2.7) display.println("         4.2V");
  607.     if (battLow3 == 0.9) display.println("         1.5V");
  608.     display.println("         KONIEC");
  609.    
  610.     display.print("U: "); display.print(battVolt3_3); display.print("V        "); display.print(battVolt3_1); display.println("V");
  611.     display.print("I: "); display.print(prad3_3); display.print("A        ");display.print(battLow3); display.println("V");
  612.     display.println("");
  613.      
  614.     display.print(mAh3); display.println("mAh");
  615.    
  616.     if (rw3 > 0)
  617.     {
  618.       display.print("Rw: ");
  619.       display.print(rw3);
  620.       display.println("mOhm");
  621.     }
  622.     display.print(rw33);
  623.   }
  624.   break;
  625.  
  626.   case 4:
  627.   if (d == 0)
  628.   {
  629.     display.setCursor(0, 0);
  630.     display.println("Ogniwo 4         BRAK");
  631.     display.println("");
  632.     display.println("    Umiesc ogniwo");
  633.     display.println("     w gniezdzie");
  634.   }
  635.  
  636.   if (koniec4 == false && d > 0)
  637.   {
  638.     display.setCursor(0, 0);
  639.     display.print("Ogniwo 4");
  640.     if (battLow4 == 2.7) display.println("         4.2V");
  641.     if (battLow4 == 0.9) display.println("         1.5V");
  642.     display.println("");
  643.    
  644.     display.print("U: "); display.print(battVolt4); display.print("V        "); display.print(battVolt4_1); display.println("V");
  645.     display.print("I: "); display.print(prad4); display.print("A        ");display.print(battLow4); display.println("V");
  646.     display.println("");
  647.      
  648.     display.print(mAh4); display.println("mAh");
  649.    
  650.     if (battVolt4_2 > 0)
  651.     {
  652.       if (rw4 > 0)
  653.       {
  654.         display.print("Rw: ");
  655.         display.print(rw4);
  656.         display.println("mOhm");
  657.       }
  658.       display.print(rw44);
  659.     }
  660.   }
  661.  
  662.   if (koniec4 == true)
  663.   {
  664.     display.setCursor(0, 0);
  665.     display.print("Ogniwo 4");
  666.     if (battLow4 == 2.7) display.println("         4.2V");
  667.     if (battLow4 == 0.9) display.println("         1.5V");
  668.     display.println("         KONIEC");
  669.    
  670.     display.print("U: "); display.print(battVolt4_3); display.print("V        "); display.print(battVolt4_1); display.println("V");
  671.     display.print("I: "); display.print(prad4_3); display.print("A        ");display.print(battLow4); display.println("V");
  672.     display.println("");
  673.      
  674.     display.print(mAh4); display.println("mAh");
  675.    
  676.      
  677.     if (rw4 > 0)
  678.     {
  679.       display.print("Rw: ");
  680.       display.print(rw4);
  681.       display.println("mOhm");
  682.     }
  683.     display.print(rw44);
  684.    
  685.   }
  686.   break;
  687.  
  688. }
  689. display.display();
  690. pixels.show();
  691. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement