Advertisement
kris83

Bateria

Jul 5th, 2021
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.72 KB | None | 0 0
  1. void Bateria(void) {
  2. value_1 = analogRead(A0);
  3. Cela_1_out = (value_1 * 5.0) / 1024.0; // see text
  4. Cela_1_in = Cela_1_out / (R2_Cela_1 / (R1_Cela_1 + R2_Cela_1));
  5. if (Cela_1_in < 0.09) {
  6. Cela_1_in = 0.0; //statement to quash undesired reading !
  7. }
  8. value_2 = analogRead(A1);
  9. Cela_2_out = (value_2 * 5.0) / 1024.0; // see text
  10. Cela_2_in = Cela_2_out / (R2_Cela_1 / (R1_Cela_1 + R2_Cela_1));
  11. if (Cela_2_in < 0.09) {
  12. Cela_2_in = 0.0; //statement to quash undesired reading !
  13. }
  14. value_3 = analogRead(A2);
  15. Cela_3_out = (value_3 * 5.0) / 1024.0; // see text
  16. Cela_3_in = Cela_3_out / (R2_Cela_3 / (R1_Cela_3 + R2_Cela_3));
  17. if (Cela_3_in < 0.09) {
  18. Cela_3_in = 0.0; //statement to quash undesired reading !
  19. }
  20. value_4 = analogRead(A3);
  21. Cela_4_out = (value_4 * 5.0) / 1024.0; // see text
  22. Cela_4_in = Cela_4_out / (R2_Cela_4 / (R1_Cela_4 + R2_Cela_4));
  23. if (Cela_4_in < 0.09) {
  24. Cela_4_in = 0.0; //statement to quash undesired reading !
  25. }
  26. value_5 = analogRead(A4);
  27. Cela_5_out = (value_5 * 5.0) / 1024.0; // see text
  28. Cela_5_in = Cela_5_out / (R2_Cela_5 / (R1_Cela_5 + R2_Cela_5));
  29. if (Cela_5_in < 0.09) {
  30. Cela_5_in = 0.0; //statement to quash undesired reading !
  31. }
  32. value_6 = analogRead(A5);
  33. Cela_6_out = (value_6 * 5.0) / 1024.0; // see text
  34. Cela_6_in = Cela_6_out / (R2_Cela_6 / (R1_Cela_6 + R2_Cela_6));
  35. if (Cela_6_in < 0.09) {
  36. Cela_6_in = 0.0; //statement to quash undesired reading !
  37. }
  38. value_6 = analogRead(A5);
  39. Cela_6_out = (value_6 * 5.0) / 1024.0; // see text
  40. Cela_6_in = Cela_6_out / (R2_Cela_6 / (R1_Cela_6 + R2_Cela_6));
  41. if (Cela_6_in < 0.09) {
  42. Cela_6_in = 0.0; //statement to quash undesired reading !
  43. }
  44. value_7 = analogRead(A6);
  45. Cela_7_out = (value_7 * 5.0) / 1024.0; // see text
  46. Cela_7_in = Cela_7_out / (R2_Cela_7 / (R1_Cela_7 + R2_Cela_7));
  47. if (Cela_7_in < 0.09) {
  48. Cela_7_in = 0.0; //statement to quash undesired reading !
  49. }
  50. value_8 = analogRead(A7);
  51. Cela_8_out = (value_8 * 5.0) / 1024.0; // see text
  52. Cela_8_in = Cela_8_out / (R2_Cela_8 / (R1_Cela_8 + R2_Cela_8));
  53. if (Cela_8_in < 0.09) {
  54. Cela_8_in = 0.0; //statement to quash undesired reading !
  55. }
  56. value_9 = analogRead(A8);
  57. Cela_9_out = (value_9 * 5.0) / 1024.0; // see text
  58. Cela_9_in = Cela_9_out / (R2_Cela_9 / (R1_Cela_9 + R2_Cela_9));
  59. if (Cela_9_in < 0.09) {
  60. Cela_9_in = 0.0; //statement to quash undesired reading !
  61. }
  62. value_10 = analogRead(A9);
  63. Cela_10_out = (value_10 * 5.0) / 1024.0; // see text
  64. Cela_10_in = Cela_10_out / (R2_Cela_10 / (R1_Cela_10 + R2_Cela_10));
  65. if (Cela_10_in < 0.09) {
  66. Cela_10_in = 0.0; //statement to quash undesired reading !
  67. }
  68. value_11 = analogRead(A10);
  69. Cela_11_out = (value_11 * 5.0) / 1024.0; // see text
  70. Cela_11_in = Cela_11_out / (R2_Cela_11 / (R1_Cela_11 + R2_Cela_11));
  71. if (Cela_11_in < 0.09) {
  72. Cela_11_in = 0.0; //statement to quash undesired reading !
  73. }
  74. value_12 = analogRead(A11);
  75. Cela_12_out = (value_12 * 5.0) / 1024.0; // see text
  76. Cela_12_in = Cela_12_out / (R2_Cela_12 / (R1_Cela_12 + R2_Cela_12));
  77. if (Cela_12_in < 0.09) {
  78. Cela_12_in = 0.0; //statement to quash undesired reading !
  79. }
  80. value_13 = analogRead(A12);
  81. Cela_13_out = (value_13 * 5.0) / 1024.0; // see text
  82. Cela_13_in = Cela_13_out / (R2_Cela_13 / (R1_Cela_13 + R2_Cela_13));
  83. if (Cela_13_in < 0.09) {
  84. Cela_13_in = 0.0; //statement to quash undesired reading !
  85. }
  86. value_14 = analogRead(A13);
  87. Cela_14_out = (value_14 * 5.0) / 1024.0; // see text
  88. Cela_14_in = Cela_10_out / (R2_Cela_14 / (R1_Cela_14 + R2_Cela_14));
  89. if (Cela_14_in < 0.09) {
  90. Cela_14_in = 0.0; //statement to quash undesired reading !
  91. }
  92. value_15 = analogRead(A14);
  93. Cela_15_out = (value_15 * 5.0) / 1024.0; // see text
  94. Cela_15_in = Cela_15_out / (R2_Cela_15 / (R1_Cela_15 + R2_Cela_15));
  95. if (Cela_15_in < 0.09) {
  96. Cela_15_in = 0.0; //statement to quash undesired reading !
  97. }
  98. value_16 = analogRead(A15);
  99. Cela_16_out = (value_16 * 5.0) / 1024.0; // see text
  100. Cela_16_in = Cela_16_out / (R2_Cela_16 / (R1_Cela_16 + R2_Cela_16));
  101. if (Cela_16_in < 0.09) {
  102. Cela_16_in = 0.0; //statement to quash undesired reading !
  103. }
  104.  
  105. if (A0 >= 0 && A0 <= 113) {
  106. RemoteXY.led_0_r = HIGH ? 255 : 0;
  107. } else {
  108. RemoteXY.led_0_r = LOW ? 255 : 0;
  109. }
  110.  
  111. if (A0 >= 114 && A0 <= 226) {
  112. RemoteXY.led_0_r = HIGH ? 255 : 0;
  113. RemoteXY.led_1_r = HIGH ? 255 : 0;
  114. } else {
  115. RemoteXY.led_0_r = LOW ? 255 : 0;
  116. RemoteXY.led_1_r = LOW ? 255 : 0;
  117. }
  118. if (A0 >= 227 && A0 <= 339) {
  119. RemoteXY.led_0_r = HIGH ? 255 : 0;
  120. RemoteXY.led_1_r = HIGH ? 255 : 0;
  121. RemoteXY.led_2_r = HIGH ? 255 : 0;
  122. } else {
  123. RemoteXY.led_0_r = LOW ? 255 : 0;
  124. RemoteXY.led_1_r = LOW ? 255 : 0;
  125. RemoteXY.led_2_r = LOW ? 255 : 0;
  126. }
  127. /* if (Suma_napiec >= 340 && Suma_napiec <= 452) {
  128. RemoteXY.led_0_r = HIGH ? 255 : 0;
  129. RemoteXY.led_1_r = HIGH ? 255 : 0;
  130. RemoteXY.led_2_r = HIGH ? 255 : 0;
  131. RemoteXY.led_3_r = HIGH ? 255 : 0;
  132. RemoteXY.led_3_g = HIGH ? 255 : 0;
  133. } else {
  134. RemoteXY.led_0_r = LOW ? 255 : 0;
  135. RemoteXY.led_1_r = LOW ? 255 : 0;
  136. RemoteXY.led_2_r = LOW ? 255 : 0;
  137. RemoteXY.led_3_r = LOW ? 255 : 0;
  138. RemoteXY.led_3_g = LOW ? 255 : 0;
  139. }
  140. if (Suma_napiec >= 453 && Suma_napiec <= 565) {
  141. RemoteXY.led_0_r = HIGH ? 255 : 0;
  142. RemoteXY.led_1_r = HIGH ? 255 : 0;
  143. RemoteXY.led_2_r = HIGH ? 255 : 0;
  144. RemoteXY.led_3_r = HIGH ? 255 : 0;
  145. RemoteXY.led_3_g = HIGH ? 255 : 0;
  146. RemoteXY.led_4_r = HIGH ? 255 : 0;
  147. RemoteXY.led_4_g = HIGH ? 255 : 0;
  148. } else {
  149. RemoteXY.led_0_r = LOW ? 255 : 0;
  150. RemoteXY.led_1_r = LOW ? 255 : 0;
  151. RemoteXY.led_2_r = LOW ? 255 : 0;
  152. RemoteXY.led_3_r = LOW ? 255 : 0;
  153. RemoteXY.led_3_g = LOW ? 255 : 0;
  154. RemoteXY.led_4_r = LOW ? 255 : 0;
  155. RemoteXY.led_4_g = LOW ? 255 : 0;
  156. }
  157. if (Suma_napiec >= 566 && Suma_napiec <= 678) {
  158. RemoteXY.led_0_r = HIGH ? 255 : 0;
  159. RemoteXY.led_1_r = HIGH ? 255 : 0;
  160. RemoteXY.led_2_r = HIGH ? 255 : 0;
  161. RemoteXY.led_3_r = HIGH ? 255 : 0;
  162. RemoteXY.led_3_g = HIGH ? 255 : 0;
  163. RemoteXY.led_4_r = HIGH ? 255 : 0;
  164. RemoteXY.led_4_g = HIGH ? 255 : 0;
  165. RemoteXY.led_5_r = HIGH ? 255 : 0;
  166. RemoteXY.led_5_g = HIGH ? 255 : 0;
  167. } else {
  168. RemoteXY.led_0_r = LOW ? 255 : 0;
  169. RemoteXY.led_1_r = LOW ? 255 : 0;
  170. RemoteXY.led_2_r = LOW ? 255 : 0;
  171. RemoteXY.led_3_r = LOW ? 255 : 0;
  172. RemoteXY.led_3_g = LOW ? 255 : 0;
  173. RemoteXY.led_4_r = LOW ? 255 : 0;
  174. RemoteXY.led_4_g = LOW ? 255 : 0;
  175. RemoteXY.led_5_r = LOW ? 255 : 0;
  176. RemoteXY.led_5_g = LOW ? 255 : 0;
  177. }
  178. if (Suma_napiec >= 679 && Suma_napiec <= 791) {
  179. RemoteXY.led_0_r = HIGH ? 255 : 0;
  180. RemoteXY.led_1_r = HIGH ? 255 : 0;
  181. RemoteXY.led_2_r = HIGH ? 255 : 0;
  182. RemoteXY.led_3_r = HIGH ? 255 : 0;
  183. RemoteXY.led_3_g = HIGH ? 255 : 0;
  184. RemoteXY.led_4_r = HIGH ? 255 : 0;
  185. RemoteXY.led_4_g = HIGH ? 255 : 0;
  186. RemoteXY.led_5_r = HIGH ? 255 : 0;
  187. RemoteXY.led_5_g = HIGH ? 255 : 0;
  188. RemoteXY.led_6_g = HIGH ? 255 : 0;
  189. } else {
  190. RemoteXY.led_0_r = LOW ? 255 : 0;
  191. RemoteXY.led_1_r = LOW ? 255 : 0;
  192. RemoteXY.led_2_r = LOW ? 255 : 0;
  193. RemoteXY.led_3_r = LOW ? 255 : 0;
  194. RemoteXY.led_3_g = LOW ? 255 : 0;
  195. RemoteXY.led_4_r = LOW ? 255 : 0;
  196. RemoteXY.led_4_g = LOW ? 255 : 0;
  197. RemoteXY.led_5_r = LOW ? 255 : 0;
  198. RemoteXY.led_5_g = LOW ? 255 : 0;
  199. RemoteXY.led_6_g = LOW ? 255 : 0;
  200. }
  201. if (Suma_napiec >= 792 && Suma_napiec <= 904) {
  202. RemoteXY.led_0_r = HIGH ? 255 : 0;
  203. RemoteXY.led_1_r = HIGH ? 255 : 0;
  204. RemoteXY.led_2_r = HIGH ? 255 : 0;
  205. RemoteXY.led_3_r = HIGH ? 255 : 0;
  206. RemoteXY.led_3_g = HIGH ? 255 : 0;
  207. RemoteXY.led_4_r = HIGH ? 255 : 0;
  208. RemoteXY.led_4_g = HIGH ? 255 : 0;
  209. RemoteXY.led_5_r = HIGH ? 255 : 0;
  210. RemoteXY.led_5_g = HIGH ? 255 : 0;
  211. RemoteXY.led_6_g = HIGH ? 255 : 0;
  212. RemoteXY.led_7_g = HIGH ? 255 : 0;
  213. } else {
  214. RemoteXY.led_0_r = LOW ? 255 : 0;
  215. RemoteXY.led_1_r = LOW ? 255 : 0;
  216. RemoteXY.led_2_r = LOW ? 255 : 0;
  217. RemoteXY.led_3_r = LOW ? 255 : 0;
  218. RemoteXY.led_3_g = LOW ? 255 : 0;
  219. RemoteXY.led_4_r = LOW ? 255 : 0;
  220. RemoteXY.led_4_g = LOW ? 255 : 0;
  221. RemoteXY.led_5_r = LOW ? 255 : 0;
  222. RemoteXY.led_5_g = LOW ? 255 : 0;
  223. RemoteXY.led_6_g = LOW ? 255 : 0;
  224. RemoteXY.led_7_g = LOW ? 255 : 0;
  225. }
  226. if (Suma_napiec >= 905 && Suma_napiec <= 1017) {
  227. RemoteXY.led_0_r = HIGH ? 255 : 0;
  228. RemoteXY.led_1_r = HIGH ? 255 : 0;
  229. RemoteXY.led_2_r = HIGH ? 255 : 0;
  230. RemoteXY.led_3_r = HIGH ? 255 : 0;
  231. RemoteXY.led_3_g = HIGH ? 255 : 0;
  232. RemoteXY.led_4_r = HIGH ? 255 : 0;
  233. RemoteXY.led_4_g = HIGH ? 255 : 0;
  234. RemoteXY.led_5_r = HIGH ? 255 : 0;
  235. RemoteXY.led_5_g = HIGH ? 255 : 0;
  236. RemoteXY.led_6_g = HIGH ? 255 : 0;
  237. RemoteXY.led_7_g = HIGH ? 255 : 0;
  238. RemoteXY.led_8_g = HIGH ? 255 : 0;
  239. } else {
  240. RemoteXY.led_0_r = LOW ? 255 : 0;
  241. RemoteXY.led_1_r = LOW ? 255 : 0;
  242. RemoteXY.led_2_r = LOW ? 255 : 0;
  243. RemoteXY.led_3_r = LOW ? 255 : 0;
  244. RemoteXY.led_3_g = LOW ? 255 : 0;
  245. RemoteXY.led_4_r = LOW ? 255 : 0;
  246. RemoteXY.led_4_g = LOW ? 255 : 0;
  247. RemoteXY.led_5_r = LOW ? 255 : 0;
  248. RemoteXY.led_5_g = LOW ? 255 : 0;
  249. RemoteXY.led_6_g = LOW ? 255 : 0;
  250. RemoteXY.led_7_g = LOW ? 255 : 0;
  251. RemoteXY.led_8_g = LOW ? 255 : 0;
  252. }
  253. if (Suma_napiec >= 1018 && Suma_napiec <= 1023) {
  254. RemoteXY.led_0_r = HIGH ? 255 : 0;
  255. RemoteXY.led_1_r = HIGH ? 255 : 0;
  256. RemoteXY.led_2_r = HIGH ? 255 : 0;
  257. RemoteXY.led_3_r = HIGH ? 255 : 0;
  258. RemoteXY.led_3_g = HIGH ? 255 : 0;
  259. RemoteXY.led_4_r = HIGH ? 255 : 0;
  260. RemoteXY.led_4_g = HIGH ? 255 : 0;
  261. RemoteXY.led_5_r = HIGH ? 255 : 0;
  262. RemoteXY.led_5_g = HIGH ? 255 : 0;
  263. RemoteXY.led_6_g = HIGH ? 255 : 0;
  264. RemoteXY.led_7_g = HIGH ? 255 : 0;
  265. RemoteXY.led_8_g = HIGH ? 255 : 0;
  266. RemoteXY.led_9_g = HIGH ? 255 : 0;
  267. } else {
  268. RemoteXY.led_0_r = LOW ? 255 : 0;
  269. RemoteXY.led_1_r = LOW ? 255 : 0;
  270. RemoteXY.led_2_r = LOW ? 255 : 0;
  271. RemoteXY.led_3_r = LOW ? 255 : 0;
  272. RemoteXY.led_3_g = LOW ? 255 : 0;
  273. RemoteXY.led_4_r = LOW ? 255 : 0;
  274. RemoteXY.led_4_g = LOW ? 255 : 0;
  275. RemoteXY.led_5_r = LOW ? 255 : 0;
  276. RemoteXY.led_5_g = LOW ? 255 : 0;
  277. RemoteXY.led_6_g = LOW ? 255 : 0;
  278. RemoteXY.led_7_g = LOW ? 255 : 0;
  279. RemoteXY.led_8_g = LOW ? 255 : 0;
  280. RemoteXY.led_9_g = LOW ? 255 : 0;
  281. }*/
  282. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement