Denver / Mbed 2 deprecated denver_train_proj

Dependencies:   mbed TextLCD

Revision:
39:9cce8f2c50b6
Parent:
38:b9aba3715682
Parent:
37:bb15bea420a3
Child:
40:9acc1341456a
--- a/main.cpp	Thu Jun 14 13:12:36 2018 +0000
+++ b/main.cpp	Thu Jun 14 13:16:31 2018 +0000
@@ -159,6 +159,7 @@
 vector<Position> positions;
 
 
+<<<<<<< local
 //.....DCC TRAIN COMMAND VARS
 
 //typical out of box default engine DCC address is 3 (at least for Bachmann trains)
@@ -191,6 +192,8 @@
 const unsigned int SWBflip_3 = 0x84; //Flip SW3
 const unsigned int SWBflip_4 = 0x88; //Flip SW4
 
+=======
+>>>>>>> other
 //Starting position and orientation of the trains
 int DR_train_pos = D4;
 bool DR_cw = true;
@@ -312,12 +315,13 @@
 
 /**
 *
-*/
-
+*Returns the number of the sensor where the train was detected.
+*
+**/
 int get_sensor(unsigned int number,int interrupt){
     int sensor = -1;
     
-    for(int i=0; i<8;i++){
+    for(int i=0; i<8; i++){
         
         if(~number & 1<<i){            
             sensor = i; 
@@ -325,7 +329,7 @@
     }
     
     if(interrupt == 1){
-        sensor+=8; // Sensors caught by interreupt1 are identified from 8 to 15.
+        sensor+= 8; // Sensors caught by interreupt1 are identified from 8 to 15.
     }
     return sensor;
 }
@@ -335,6 +339,7 @@
     bool found_LR = false;    
     
     
+<<<<<<< local
      Position pos = positions[sensor];
      
      lcd.cls();
@@ -342,6 +347,10 @@
      //wait(1);   
      for(int i = 0; i<pos.get_prev_cw().size();i++){
             
+=======
+    Position pos = positions[sensor];
+    for(int i = 0; i<pos.get_prev_cw().size();i++){
+>>>>>>> other
             int prev = pos.get_prev_cw()[i];
             
             if(DR_train_pos == prev){
@@ -349,6 +358,7 @@
               found_DR = true;
               DR_train_pos = sensor; //We update the position of the train  
             }
+            
             if(LR_train_pos == prev){
                 found_LR = true;
                 LR_train_pos = sensor;   //We update the position of the train  
@@ -362,10 +372,17 @@
         
     }
     if(found_LR){
+<<<<<<< local
         //doBuzz();
+=======
+>>>>>>> other
         lcd.cls();
+<<<<<<< local
         lcd.printf("LR is at D%d",LR_train_pos); 
           
+=======
+        lcd.printf("LR is at D%d",LR_train_pos);   
+>>>>>>> other
     }
     if(!found_DR && !found_LR){
         lcd.cls();
@@ -373,6 +390,7 @@
     }
 }
 
+
 /**
 *
 *Method to catch interrupts 0
@@ -420,34 +438,6 @@
   }
 
 
-
-
-/**
-*
-*Print the positions where there is a 0
-*
-**/
-
-void train_pos_update(unsigned int number){
-    
-    /*
-    bitset <sizeof(unsigned int) * 8> n (number);
-    
-    cout << "Binary: " << n << endl;
-    */
-    
-    for(int i=0; i<16;i++){
-        
-        if(~number & 1<<i){
-            
-            cout << "There is a 0 at " << i << endl;
-            pos_trains[1] = pos_trains[0]; 
-            pos_trains[0] = i; 
-        }
-    }
- }
- 
- 
 /**
 *
 *Method to send DCC commands to train and switches.