Last active
August 29, 2015 14:13
-
-
Save masui/36037cb1e5003eaf89c0 to your computer and use it in GitHub Desktop.
Raspberry PiのRubyでマウスホイール信号を取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.open("/dev/input/event0","rb"){ |f| | |
while true do | |
s = f.read 16 | |
(time, type, code, value) = s.unpack "qssi" | |
if type == 2 and code == 8 then | |
puts value | |
end | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment