From cdb878d0d0440d8ff2982c74cf35fef1fd7f80cd Mon Sep 17 00:00:00 2001 From: Luke McFarlane Date: Sun, 23 Oct 2016 11:34:57 +1300 Subject: [PATCH] Add INPUT_PULLUP pin mode. --- lib/arduino_firmata/const.rb | 19 ++++++++++--------- test/test_arduino_firmata.rb | 6 +++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/arduino_firmata/const.rb b/lib/arduino_firmata/const.rb index 5558e04..6778e76 100644 --- a/lib/arduino_firmata/const.rb +++ b/lib/arduino_firmata/const.rb @@ -18,15 +18,16 @@ class Status OPEN = 1 end - INPUT = 0 - OUTPUT = 1 - ANALOG = 2 - PWM = 3 - SERVO = 4 - SHIFT = 5 - I2C = 6 - LOW = 0 - HIGH = 1 + INPUT = 0 + OUTPUT = 1 + ANALOG = 2 + PWM = 3 + SERVO = 4 + SHIFT = 5 + I2C = 6 + INPUT_PULLUP = 11 + LOW = 0 + HIGH = 1 MAX_DATA_BYTES = 32 DIGITAL_MESSAGE = 0x90 # send data for a digital port diff --git a/test/test_arduino_firmata.rb b/test/test_arduino_firmata.rb index 1357174..45f05a7 100644 --- a/test/test_arduino_firmata.rb +++ b/test/test_arduino_firmata.rb @@ -51,7 +51,11 @@ def test_servo_write def test_pin_mode 0.upto(13).each do |pin| - mode = [ArduinoFirmata::OUTPUT, ArduinoFirmata::INPUT].sample + mode = [ + ArduinoFirmata::OUTPUT, + ArduinoFirmata::INPUT, + ArduinoFirmata::INPUT_PULLUP + ].sample assert @arduino.pin_mode(pin, mode) == mode end end