parent
72de1f5c99
commit
aa17ee3f94
|
@ -110,7 +110,8 @@ union ReceivedCommand_t {
|
|||
#define CHAR_DASH 10
|
||||
const uint8_t segment[16] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x40, 0x00, 0x3f, 0x00, 0x00, 0x73}; //0,1,2,3,4,5,6,7,8,9,-, , , , ,P
|
||||
|
||||
boolean dataAvailable(char &digit) {
|
||||
boolean dataAvailable(char &digit)
|
||||
{
|
||||
if (Serial1.available())
|
||||
{
|
||||
digit = Serial1.read(); // Read serial buffer
|
||||
|
@ -208,12 +209,20 @@ void loop()
|
|||
digitalWrite(GREENP_PIN, ReceivedCommand.t.TrafficLightRight & _BV(0)); // green right side
|
||||
digitalWrite(ORANGEP_PIN, ReceivedCommand.t.TrafficLightRight & _BV(1)); // orange right side
|
||||
digitalWrite(REDP_PIN, ReceivedCommand.t.TrafficLightRight & _BV(2)); // red right side
|
||||
|
||||
CATPORT(TRAFLIGHT_PORT) = (ReceivedCommand.t.TrafficLightRight & _BV(0) ? 0b1001 << 2: 0) |
|
||||
(ReceivedCommand.t.TrafficLightRight & _BV(1) ? 0b1001 << 1 : 0) |
|
||||
(ReceivedCommand.t.TrafficLightRight & _BV(2) ? 0b1001 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
digitalWrite(GREENP_PIN, ReceivedCommand.t.TrafficLightLeft & _BV(0)); // green left side
|
||||
digitalWrite(ORANGEP_PIN, ReceivedCommand.t.TrafficLightLeft & _BV(1)); // orange left side
|
||||
digitalWrite(REDP_PIN, ReceivedCommand.t.TrafficLightLeft & _BV(2)); // red left side
|
||||
|
||||
CATPORT(TRAFLIGHT_PORT) = (ReceivedCommand.t.TrafficLightLeft & _BV(0) ? 0b1001 << 2 : 0) |
|
||||
(ReceivedCommand.t.TrafficLightLeft & _BV(1) ? 0b1001 << 1 : 0) |
|
||||
(ReceivedCommand.t.TrafficLightLeft & _BV(2) ? 0b1001 : 0);
|
||||
}
|
||||
|
||||
// Set ABCD(EF)
|
||||
|
|
Loading…
Reference in New Issue