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

ArduinoでPCの電源ボタンを押してみる

5a447fca6242f674ef991573cf7d29f7?s=47 isuka
July 03, 2016

 ArduinoでPCの電源ボタンを押してみる

YAPC::ASIA HACHIOJI 2016 MID IN SHINAGAWA
LT#111発表資料

5a447fca6242f674ef991573cf7d29f7?s=128

isuka

July 03, 2016
Tweet

Transcript

  1. "SEVJOPͰ1$ͷిݯϘλϯΛԡͯ͠ΈΔ :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5

  2. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ࣗݾ঺հ ▸ UXJUUFSJTVLB ▸ IUUQTUXJUUFSDPNJTVLB ▸ (JU)VCJTVLB ▸ IUUQTHJUIVCDPNJTVLB

    ▸ ࢓ࣄ ▸ ϝΠϯϑϨʔϜͷϑΝʔϜ΢ΣΞٕज़ऀ ▸ 15൘ͷઃܭ΍ͦͷϑΝʔϜ։ൃ
  3. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 04*ࢀরϞσϧ 4FTTJPO-BZFS 1SFTFOUBUJPO-BZFS "QQMJDBUJPO-BZFS %BUB-JOL-BZFS /FUXPSL-BZFS 5SBOTQPSU-BZFS 1IZTJDBM-BZFS

  4. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 04*ࢀরϞσϧ 4FTTJPO-BZFS 1SFTFOUBUJPO-BZFS "QQMJDBUJPO-BZFS %BUB-JOL-BZFS /FUXPSL-BZFS 5SBOTQPSU-BZFS 1IZTJDBM-BZFS

  5. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 04*ࢀরϞσϧ 4FTTJPO-BZFS 1SFTFOUBUJPO-BZFS "QQMJDBUJPO-BZFS %BUB-JOL-BZFS /FUXPSL-BZFS 5SBOTQPSU-BZFS 1IZTJDBM-BZFS 1IZTJDBM

  6. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ࠓ೔͸1IZTJDBM ճ࿏ઃܭ ͷ࿩Λ͠·͢ ▸ ΍Δ͜ͱɿ1$ αʔό ͷిݯϘλϯΛԡ͢ɻ ▸ ։ൃதͩͱαʔόͷϑΝʔϜ͕ྑ͘ࢮ͵ͷͰසൟʹ࠶ىಈ͕ඞཁɻ

    ▸ Ͱ΋ɺεΠονʹखΛ৳͹͢ͷ͸໘౗͍͘͞ɻ
  7. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ▸ ΍Δ͜ͱɿ1$ αʔό ͷిݯϘλϯΛԡ͢ɻ ▸ ։ൃதͩͱαʔόͷϑΝʔϜ͕ྑ͘ࢮ͵ͷͰසൟʹ࠶ىಈ͕ඞཁɻ ▸ Ͱ΋ɺεΠονʹखΛ৳͹͢ͷ͸໘౗͍͘͞ɻ ͦ͏ͩɺλʔϛφϧ͔ΒεΠονΛԡͦ͏ɻ

    ࠓ೔͸1IZTJDBM ճ࿏ઃܭ ͷ࿩Λ͠·͢
  8. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ిݯϘλϯͷ࢓૊Έ ▸ ϓογϡεΠονλΠϓ ▸ ԡͨ࣌͠ʹಋ௨ͯ͠௨ৗ͸Φʔϓϯঢ়ଶ ▸ 0/΋0''΋ಉ͡ ▸ τάϧεΠονλΠϓ

    ▸ ԡ͢౓ʹಋ௨ඇಋ௨͕੾ΓସΘΔ ▸ 0/ɿಋ௨ ▸ 0''ɿඇಋ௨ 7DD 7 7 SFTFU 7DD 7 7 SFTFU 7DD 7 7 SFTFU 7DD 7 7 SFTFU
  9. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 λʔϛφϧ͔ΒεΠονΛԡ͢ ▸ "SEVJOP͔ΒεΠονϘλϯͬΆ͍ిѹγʔέϯεΛग़ྗͤ͞Δɻ ▸ γϦΞϧίϯιʔϧܦ༝ͰίϚϯυΛୟ͍ͯ0''0/͢Δɻ void loop() { digitalWrite(powerPin,

    HIGH); delay(500); digitalWrite(powerPin, LOW); }
  10. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 λʔϛφϧ͔ΒεΠονΛԡ͢ ▸ "SEVJOP͔ΒεΠονϘλϯͬΆ͍ిѹγʔέϯεΛग़ྗͤ͞Δɻ ▸ γϦΞϧίϯιʔϧܦ༝ͰίϚϯυΛୟ͍ͯ0''0/͢Δɻ ؆୯ͦ͏ɻ void loop() {

    digitalWrite(powerPin, HIGH); delay(500); digitalWrite(powerPin, LOW); }
  11. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ߟ͑ͨϞϊ ▸ *0ϐϯʹεΠονઢΛ઀ଓɻ ▸ EJHJUBM8SJUF QPXFS1JO -08  ▸

    SFTFU͕ిݯϘλϯΛԡ͞Εͨͱೝࣝ͢Δɻ 7DD 7 SFTFU 7DD 7 )JHI 7 SFTFU QPXFS1JO "SEVJOP QPXFS1JO "SEVJOP -PX 7 7ʁ
  12. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ߟ͑ͨϞϊ ▸ *0ϐϯʹεΠονઢΛ઀ଓɻ ▸ EJHJUBM8SJUF QPXFS1JO -08  ▸

    SFTFU͕ిݯϘλϯΛԡ͞Εͨͱೝࣝ͢Δɻ 7DD 7 SFTFU 7DD 7 )JHI 7 SFTFU QPXFS1JO "SEVJOP QPXFS1JO "SEVJOP -PX 7 ʂ7 ಈ͔ͳ͍ɻ
  13. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ͳΜͰʁ ▸ EJHJUBM8SJUF QPXFS1JO -08 ͱ͸-08 7 ͷग़ྗͷ͜ͱɻ ▸

    ిݯϘλϯΛԡͨ͢Ίʹ͸(/% 7 ͰҾ͘ ೖྗ ͢Δඞཁ͕͋Δɻ
  14. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ͳΜͰʁ ▸ EJHJUBM8SJUF QPXFS1JO -08 ͱ͸-08 7 ͷग़ྗͷ͜ͱɻ ▸

    ిݯϘλϯΛԡͨ͢Ίʹ͸(/% 7 ͰҾ͘ ೖྗ ͢Δඞཁ͕͋Δɻ ͔͠͠ɺ ▸ QPXFS1JOͷೖྗํ޲͸)J;ͳͷͰҾ͚ͳ͍ɻ ▸ "73ͷ%BUB4IFFUݟͯ΋ࣗ໌ɻ
  15. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ෼͔ͬͨ͜ͱ "SEVJOP୯ମͰ͸ແཧ

  16. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏Λߟ͑ͯΈΔ ▸ ࠷΋؆୯ͳͷ͸ϦϨʔΛ࢖͏ɻ ▸ ճ࿏తʹ͸ిݯϘλϯͱ౳Ձɻ 7DD 7 SFTFU QPXFS1JO

    "SEVJOP
  17. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏Λߟ͑ͯΈΔ ▸ ࠷΋؆୯ͳͷ͸ϦϨʔΛ࢖͏ɻ ▸ ճ࿏తʹ͸ిݯϘλϯͱ౳Ձɻ ▸ εΠονϯάిѹ͕ߴ͍΋ͷ 7Ҏ্ ͕ଟ͍ɻ

    ▸ "SEVJOPͰ͸ಈ͔ͤͳ͍ɻ ▸ "73ͷ%BUB4IFFUݟͯ΋ࣗ໌ɻ 7DD 7 SFTFU QPXFS1JO "SEVJOP
  18. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏Λߟ͑ͯΈΔ ▸ ࠷΋؆୯ͳͷ͸ϦϨʔΛ࢖͏ɻ ▸ ճ࿏తʹ͸ిݯϘλϯͱ౳Ձɻ ▸ εΠονϯάిѹ͕ߴ͍΋ͷ 7Ҏ্ ͕ଟ͍ɻ

    ▸ "SEVJOPͰ͸ಈ͔ͤͳ͍ɻ ▸ "73ͷ%BUB4IFFUݟͯ΋ࣗ໌ɻ 7DD 7 SFTFU QPXFS1JO "SEVJOP Ϙπɻ
  19. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏Λߟ͑ͯΈΔᶄ ▸ τϥϯδελεΠονΛ࢖͏ɻ ▸ ͜ΕͰ͍͚ͳ͍ͱ͔ແ͍ͩΖɻ

  20. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏ઃܭ ▸ &"(-&͕ϑϦʔͰ࢖͑ͯศར ▸ IUUQXXXDBETPGUEFEPXOMPBEFBHMF ▸ 8JOEPXT-JOVY.BDରԠ

  21. None
  22. None
  23. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏ઃܭ ▸ Կ͔Βߦ͑͹Α͍͔ʁ ▸ ճ࿏ͷిݯʹ͍ͭͯ ▸ "SEVJOPͷग़ྗ͕7ͳͷͰ7ͷૉࢠΛ࢖༻ɻ ▸ ߪೖ͢Δ*$ྨ͸7DD7඼ɻ

  24. ᶄ ᶅ ᶃ ᶆ ᶇ

  25. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏ઃܭᶃ-&% ▸ ిݯೖΕͨ࣌ʹ෇͘-&%ͱ͔ͷࣄɻ ▸ ిࢠճ࿏ͷ)BMMP8PSMEɻ ▸ ద౰ʹ఍߅ೖΕΕ͹0,ɻ

  26. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏ઃܭᶄϦηοτճ࿏ ▸ "SEVJOPॳظԽ࣌ͷঢ়ଶ͸ෆఆɻ ▸ *0ϐϯͷঢ়ଶ͕҆ఆ͢Δ·Ͱ଴ͭɻ ▸ ඵఔ౓଴ͭͨΊͷ$3஋ɻ ▸ γϡϛοττϦΨͰνϟλϦϯά๷ࢭɻ

    ▸ ''ͷঢ়ଶΛ3&4&5@%0/&ͱͯ͠ݟΔɻ
  27. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏ઃܭᶅεΠονճ࿏ ▸ τϥϯδελΛ࢖ͬͨεΠονճ࿏ɻ ▸ ϕʔε ࠨଆ ͔ΒిྲྀΛྲྀ͢ͱӈ͔Βిྲྀ͕ྲྀΕΔɻ ▸ ૿෯΋ແͨͩ͘εΠον͢Δ͚ͩɻ

  28. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏ઃܭᶆϨδελճ࿏ ▸ ιϑτ͔Βݟͨ࣌ʹϨδελͱͯ͠ݟ͑Δɻ ▸ ͋ΔͱԿ͔ͦΕͬΆ͍ɻ ▸ ແͯ͘΋ػೳతʹ໰୊ͳ͍ɻ ▸ ''

    'MJQ'MPQ ΛϨδελʹ࢖༻ɻ ▸ 3FBE8SJUFՄೳɻ
  29. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ճ࿏ઃܭᶇԡ͠ϘλϯεΠον ▸ खΛ৳͹ͤΔਓ༻εΠον ▸ ແͯ͘΋ྑ͍ɻ ▸ ͱ͍͏͔झࢫʹ൓͍ͯ͠Δɻ ▸ ࣮͸νϟλϦϯά๷ࢭճ࿏͕ؒҧ͍ͬͯΔɻ

  30. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ࣮૷ઃܭ ▸ ͜Ε΋&"(-&ͰҰԠՄೳɻ ▸ Ϣχόʔαϧج൘ʹ෦඼Λฒ΂Δ৔߹͸ෆཁɻ ▸ ຕఔ౓࡞ΔͳΒ1൘DPN౳ʹཔΜͩΓ͢Δɻ ▸ IUUQTXXXQCBODPN

  31. None
  32. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ෦඼୳͠ ▸ ळ݄ిࢠ ▸ IUUQBLJ[VLJEFOTIJDPNDBUBMPHEFGBVMUBTQY ▸ Ϛϧπύʔπ ▸ IUUQXXXNBSVUTVDPKQ

    ▸ ిݯిѹɾύοέʔδͰݕࡧͨ͠ΓσʔλγʔτݟͨΓͯ͠෦඼બఆɻ ▸ ͕݁͜͜ߏ໘౗ɻ ▸ *$͸ిݯిѹͱཉ͍͠ճ࿏Ͱ͙ܾ͢·Δɻ ▸ τϥϯδελ͸छྨ͕ଟ͍ͷͰएׯબͼʹ͍͘ɻ
  33. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ࢼ࡞

  34. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ಈ࡞֬ೝ͕ग़དྷͨΒϢχόʔαϧج൘ʹ෦඼Λฒ΂ͯʜ

  35. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 ׬੒ʂ

  36. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 σϞ

  37. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 σϞ

  38. :"1$"4*")"$)*0+*.*%*/4)*/"("8"ɹ-5 1JTOPU1FSM 1JT1IZTJDBM