Esempio n. 1
0
        public void SetPWM(ArduinoUnoPWMPins pin, int newValue)
        {
            if (firmata.IsInitialized == false)
            {
                return;
            }
            var currentPin = firmata.Pins[(int)pin];

            // TODO : Decide on whether this should throw an exception
            if (!currentPin.IsPWMMode())
            {
                return;
            }

            // Send the message to the board
            firmata.SendMessage(new AnalogMessage()
            {
                Pin = (byte)pin, Value = newValue
            });

            // Update the firmata pins list
            currentPin.CurrentValue = newValue;
        }
Esempio n. 2
0
        public void SetPWM(ArduinoUnoPWMPins pin, int newValue)
        {
            if (firmata.IsInitialized == false)
                return;
            var currentPin = firmata.Pins[(int)pin];
            // TODO : Decide on whether this should throw an exception
            if (!currentPin.IsPWMMode())
                return;

            // Send the message to the board
            firmata.SendMessage(new AnalogMessage() { Pin = (byte)pin, Value = newValue });

            // Update the firmata pins list
            currentPin.CurrentValue = newValue;
        }