Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add INPUT_PULLUP pin mode. #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lib/arduino_firmata/const.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion test/test_arduino_firmata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down