Using struct and assigning values

typedef struct
  byte None;
  byte Up;
  byte Down; 
} TriggerModes;

typedef struct
  TriggerModes Direction;
  unsigned long TriggerTime;
} PIRTrigger;

PIRTrigger Trig;

This line of code is in the setup() and is giving me this error
 Trig.Direction = TriggerModes.None;

error: expected primary-expression before '.' token
   Trig.Direction = TriggerModes.None;

Is the first meant to be an enum?

TriggerModes.None is a byte
Trig.Direction is a struct.
amongst other things, you cannot do a direct assignement.

I suspect that, instead of a struct TriggerModes, you want an enum.

1 Like

yep, sorry everyone.. time for some sleep :slight_smile:

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.