Roman Ciesarík / Mbed 2 deprecated Semestralna_praca_Roman_Ciesarik

Dependencies:   MMA8451Q mbed

Files at this revision

API Documentation at this revision

Comitter:
Ciesarik3
Date:
Fri Jan 05 22:00:44 2018 +0000
Parent:
6:83b531eead03
Child:
8:9686195ddf1d
Commit message:
pohne sa ale iba raz;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Jan 05 21:10:58 2018 +0000
+++ b/main.cpp	Fri Jan 05 22:00:44 2018 +0000
@@ -1,10 +1,10 @@
 #include "mbed.h"
 #include "headre.h"
-#include "definicie.h"
+//#include "definicie.h"
 
 
 
-/*
+
 #define DISPLAY     0x30    // DATA smer  0x01-> UP 0x02-> DOWN , text (string)
 #define TERMINAL    0xD0    // Vypise vsetko
 
@@ -44,12 +44,12 @@
 #define MOTOR   0xf1    // DATA 0x1-> STOP 0x02-> UP/DOWN 32bit <-100,100> 0x3-> MOTOR ENCODER COUNT (double)
 #define WATCHDOG 0xfe   // DATA 0x01-> time out ELSE regular reset ( 1500ms )
 
-*/
+
 Serial pc(USBTX, USBRX, 57600);
 
 int i;
 unsigned int velkost;
-char crc=0x00;/*
+char crc=0x00;
 char crc8table[256] = {
     0, 94, 188, 226, 97, 63, 221, 131, 194, 156, 126, 32, 163, 253, 31, 65,
     157, 195, 33, 127, 252, 162, 64, 30, 95, 1, 227, 189, 62, 96, 130, 220,
@@ -67,7 +67,7 @@
     87, 9, 235, 181, 54, 104, 138, 212, 149, 203, 41, 119, 244, 170, 72, 22,
     233, 183, 85, 11, 136, 214, 52, 106, 43, 117, 151, 201, 74, 20, 246, 168,
     116, 42, 200, 150, 21, 75, 169, 247, 182, 232, 10, 84, 215, 137, 107, 53
-};*/
+};
 
 // crc [0xA0, prijem, odosielatel, vrlkost dat , data (256),crc]
 //char odosli[5+sizeof(DATA)];
@@ -100,11 +100,11 @@
                  else {hore();break;}
              }
             */
-
+/*
         while(true) {
 
             if (por<5) {
-                 pc.attach(&prijmemSpravu);
+                // pc.attach(&prijmemSpravu);
                 pohyb(poradie[por]);
             
                 por++;
@@ -112,7 +112,7 @@
                 por=0;
                 pohyb(poradie[por]);
             }
-        }
+        }*/
 
 
 
@@ -205,8 +205,17 @@
             }
         }
     }
-    
+    pc.attach(&prijmemSpravu);
     rozhodni();
+    if (por<5) {
+                // pc.attach(&prijmemSpravu);
+                pohyb(poradie[por]);
+            
+                por++;
+            } else {
+                por=0;
+                pohyb(poradie[por]);
+            }
     
     pc.attach(&prijmemSpravu);
 }
@@ -472,20 +481,3 @@
 
 }
 
-void kontrola()
-{
-    char kontrola[5]= {0,0,0,0,0};
-
-    for(int i=0; i<5; i++) {
-        while(true) {
-            if(pc.readable()==1) {
-                kontrola[i]=pc.getc();
-                break;
-            }
-        }
-    }
-
-    if(kontrola[0]!=0xA0&&kontrola[1]!=0x00&&kontrola[2]!=0x00&&kontrola[3]!=0x00&&kontrola[4]!=0x00) {
-        // poslemSpravu();
-    }
-}
\ No newline at end of file