Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
semaforopeatonal [2017/02/28 03:05]
leo
semaforopeatonal [2019/10/07 17:44] (current)
leo
Line 3: Line 3:
 /* /*
 ** A state machine for a semaphore (pedestrian Traffic Light) ** A state machine for a semaphore (pedestrian Traffic Light)
-** using ponters ​to function+** using pointers ​to function
 ** Author: Leonardo Yamasaki ** Author: Leonardo Yamasaki
 ** Licence GPL Free to use. ** Licence GPL Free to use.
Line 15: Line 15:
 #define YEL2  18 #define YEL2  18
 #define GRE2  19 #define GRE2  19
-// define pin sensor ​analogico+// define pin sensor ​analog
 #define SENSOR 20 #define SENSOR 20
 +#define SENSORLIM 600
 +
 //define timmings //define timmings
 #define REDDEL 1000 #define REDDEL 1000
Line 23: Line 25:
 #define BLINKDEL 50 #define BLINKDEL 50
 #define NUMBLINK 20 #define NUMBLINK 20
- 
  
 // States red, yellow and green of two semaphores // States red, yellow and green of two semaphores
Line 85: Line 86:
   digitalWrite(GRE2,​LOW);​   digitalWrite(GRE2,​LOW);​
   // Adding sensor for peatonal use   // Adding sensor for peatonal use
-  while(analogRead(SENSOR)>​900){}+  while(analogRead(SENSOR)>​SENSORLIM){}
   statefunc = yelSem1;   statefunc = yelSem1;
   delay(GREDEL);​   delay(GREDEL);​