public void UpdateState() { // TODO: Call a GPIO library to update the state. Log.Output(Log.Severity.WARNING, Log.Source.SENSORS, "Encoder updating not implemented properly."); int AngleChange = 0; Random RandomGen = new Random(); AngleChange = RandomGen.Next(20) - 10; this.Angle += AngleChange; if (AngleChange != 0) { EncoderTurn Event = new EncoderTurn() { TurnAmount = AngleChange, Angle = this.Angle }; OnTurn(Event); } }
protected virtual void OnTurn(EncoderTurn Event) { Turned?.Invoke(this, Event); }