Upgrade to Pro — share decks privately, control downloads, hide ads and more …

玄関を Suica で開ける

Coro
February 24, 2016

玄関を Suica で開ける

デブサミ2016 [19-E-7]IoTの未来はここにあった!大集合おうちハックLT祭 で使用したスライドです
http://event.shoeisha.jp/devsumi/20160218/session/1059/

Coro

February 24, 2016
Tweet

Other Decks in How-to & DIY

Transcript

  1. ιϑτ෦෼ ϥΠϒϥϦ͕༏ल nfcpy ServoBlaster ͏͔͢͝ $ sudo apt-get install bzr

    $ cd <hoge> $ bzr branch lp:nfcpy trunk $ sudo apt-get install python-usb $ sudo python examples/tagtool.py 20
  2. ιϑτ෦෼ ϥΠϒϥϦ͕༏ल nfcpy ServoBlaster ͏͔͢͝ $ git clone git://github.com/ richardghirst/PiBits.git

    $ cd PiBits/ServoBlaster/user $ make $ sudo make install $ echo 4=90% > /dev/servoblaster 21
  3. http://a.com loop do idm = idm(nfc) unlock_user = USERS.key(idm) unless

    unlock_user == nil print("Welcome back #{unlock_user}!\n") unlock print("Wait #{AUTO_LOCK}sec...") sleep(AUTO_LOCK) print("\n") lock else print("Illegal user\n") end print("Please wait reader restart...\n") end ιϑτ෦෼ ϥΠϒϥϦ͕༏ल nfcpy ServoBlaster ͏͔͢͝ USERS = {"Bob_Marley" => "xxxxxxxxxxxxxxxx", "Alice_Cartelet" => "xxxxxxxxxxxxxxxx"} UNLOCK_ANGLE = "91" LOCK_ANGLE = "40" AUTO_LOCK = 40 def nfc() `sudo python ~/Documents/nfc/…/tagtool.py` end def idm(text) m = text.match(/ID=(.*?)\s/) idm =m[1] print("IDm = #{idm}\n") return idm end def unlock() `echo 4=#{UNLOCK_ANGLE}% > /dev/servoblaster` end def lock() `echo 4=#{LOCK_ANGLE}% > /dev/servoblaster` end 22