Advertisement
zdenekpetrzd

Diagnostika - Serial

Feb 3rd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.56 KB | None | 0 0
  1. //══════════════════════════════════════════════════════════════════════════════════════════════════════//
  2. //                                                                 Přepínač provozní diagnostiky                                                                                 //
  3. // Funkce pro ovládání diagnostiky, má dva vstupní parametry : 1) Pin PISO registru, na který je přepínač připojen                                                               //
  4. //                                                             2) CVID - trojznak definovaný v programu TStoCOM                                                                  //
  5. // Funkce posílá pomocí sériové linky hodnotu 0 nebo 1 (násobitel je 1)                                                                                                          //
  6. //══════════════════════════════════════════════════════════════════════════════════════════════════════//
  7. int aktualStavDiagnostiky = 0;
  8. int staryStavDiagnostiky[POCET_VSTUPU];
  9. //══════════════════════════════════════════════════════════════════════════════════════════════════════//
  10. void Diagnostika(int pointer, String CVID) {
  11.  
  12.   if(tlacitko[pointer] != staryStavDiagnostiky[pointer])
  13.   {
  14.     if(tlacitko[pointer] == 1) {
  15.         Serial.print(CVID);
  16.         Serial.print("1");
  17.         Serial.print("\r\n");
  18.     }
  19.     else if(tlacitko[pointer] == 0) {
  20.         Serial.print(CVID);
  21.         Serial.print("0");
  22.         Serial.print("\r\n");
  23.     }
  24.     else {
  25.         Serial.print("Chybna poloha přepínače diagnostiky!");
  26.         Serial.print("\r\n");
  27.     }
  28.     staryStavDiagnostiky[pointer] = tlacitko[pointer];
  29.   }
  30. }
  31.  
  32. //══════════════════════════════════════════════════════════════════════════════════════════════════════//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement