Advertisement
zdenekpetrzd

Untitled

Mar 13th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. void GetAll(int *seznam) {
  2. for(int i=0; i<velikost; i++) {
  3. String vypis = "GetCV(" + String(seznam[i]) + ",0)::";
  4. client.print(vypis);
  5. }
  6. }
  7.  
  8.  
  9. void Prijem() {
  10. while(client.available() > 0) {
  11. char str[210] = {};
  12. char arrayA[10] = {};
  13. char arrayB[190] = {};
  14. char delic = '=';
  15. int pozice = 0;
  16. String stringi = "";
  17. stringi = client.readStringUntil('\r\n');
  18. Serial.print(stringi);
  19. Serial.print(" je ");
  20. if(stringi.length() < 190) {
  21. stringi.toCharArray(str, 200);
  22. int pocetZnaku = strlen(str);
  23.  
  24. // Vyčištění polí pro nový zápis dat
  25. for(int i=0; i<sizeof(arrayB); i++) {
  26. arrayB[i] = (char)0;
  27. }
  28. for(int i=0; i<sizeof(arrayA); i++) {
  29. arrayA[i] = (char)0;
  30. }
  31.  
  32. // Zjištění pozice dělícího znaku "="
  33. for(int i=0; i < pocetZnaku; i++) {
  34. if(str[i] == delic) {
  35. pozice = i;
  36. }
  37. }
  38. // Před dělícím znakem jde o pole A
  39. for(int i=0; i < pozice; i++) {
  40. arrayA[i] = str[i];
  41. }
  42. // Po dělícím znaku jde o pole B
  43. for(int i=pozice+1; i < pocetZnaku; i++) {
  44. arrayB[i-pozice-1] = str[i];
  45. }
  46. Serial.println(String(arrayA) + " = " + String(arrayB));
  47. }
  48. }
  49. }
  50.  
  51. unsigned int pw [] = { 1, 10, 100, 1000, 10000, 100000, 1000000 } ;
  52. int ExtractDigit(int V, int P)
  53. {
  54. return V / pw[P] % 10 ;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement