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

Mongoose OSとIFTTTでJavaScript IoT事始め / IoT with Mongoose OS and IFTTT

shanonim
November 18, 2017

Mongoose OSとIFTTTでJavaScript IoT事始め / IoT with Mongoose OS and IFTTT

2017.11.18
秋のJavaScript祭 in mixi 2017
https://javascript-fes.doorkeeper.jp/events/66335

shanonim

November 18, 2017
Tweet

More Decks by shanonim

Other Decks in Technology

Transcript

  1. ɹɹɹɹɹɹɹɹɹͱ
    ɹɹɹɹɹɹͰ
    +BWB4DSJQU*P5ࣄ࢝Ί
    TIBOPO !TIBOPOJN

    View full-size slide

  2. "CPVUNF
    TIBOPO !TIBOPOJN

    "OESPJE ,PUMJO
    *P5

    View full-size slide

  3. ໿Ұ೥ৼΓͷࢀՃ

    View full-size slide

  4. *P5ͷ࿩Λ͠·͢

    View full-size slide

  5. lϞϊͷΠϯλʔωοτʢ*OUFSOFUPG5IJOHTɺ*P5ʣ͸ɺ
    ҰҙʹࣝผՄೳͳʮ΋ͷʯ͕ΠϯλʔωοτΫϥ΢υʹ઀ଓ͞Εɺ
    ৘ใަ׵͢Δ͜ͱʹΑΓ૬ޓʹ੍ޚ͢Δ࢓૊ΈͰ͋Δɻz
    ग़యɿ8JLJQFEJBʢIUUQTKBXJLJQFEJBPSHXJLJϞϊͷΠϯλʔωοτʣ

    View full-size slide

  6. 0, (PPHMFɺ
    ిؾΛ఺͚ͯɻ

    View full-size slide

  7. Ϟϊ͕Πϯλʔωοτʹ
    ܨ͕͍ͬͯͯɺ
    ࣗ༝ʹૢ࡞Ͱ͖Δ
    ˣ
    ศར

    View full-size slide

  8. *P5ͷΠϝʔδ
    ͋ΔͰΎ͍ͷ
    Βͣ΂Γʔͺ͍
    ૊ΈࠐΈ
    $ݴޠ
    ϋʔυ΢ΣΞ
    ௿ϨΠϠʔ
    όζϫʔυ
    Α͘Θ͔Βͳ͍ Կ͔Β͢Ε͹

    View full-size slide

  9. ࠓ೔࿩͢͜ͱ
    ϑϩϯτΤϯυͷٕज़Λ࢖ͬͯ
    खܰʹೖ໳Ͱ͖Δ
    *P5ͷ޻࡞ྫ

    View full-size slide

  10. ࠓ೔࿩͢͜ͱ
    w ϋʔυ΢ΣΞ
    w ιϑτ΢ΣΞ
    w Πϯλʔωοτʹܨ͙
    w ޻࡞ྫ
    w ·ͱΊ

    View full-size slide

  11. ࠓ೔࿩͢͜ͱ
    w ϋʔυ΢ΣΞ
    w ιϑτ΢ΣΞ
    w Πϯλʔωοτʹܨ͙
    w ޻࡞ྫ
    w ·ͱΊ
    5IJOHT
    *OUFSOFU

    View full-size slide

  12. ϋʔυ΢ΣΞ

    View full-size slide

  13. &41Sš%FWFMPQFS
    ແઢ௨৴Ϟδϡʔϧ
    ʢ8J'J#MVFUPPUIʣΛ
    ౥ࡌͨ͠։ൃϘʔυ

    View full-size slide

  14. &41Sš%FWFMPQFS༻(307&γʔϧυ
    &41S%FWFMPQFSͰ
    (307&γεςϜͷσόΠεΛ
    ࢖͏ͨΊͷγʔϧυ

    View full-size slide

  15. (SPWF4ZTUFN
    TFFFETUVEJP͕։ൃ͍ͯ͠Δ
    ͚ࠩͩ͢Ͱѻ͑Δηϯαʔ

    View full-size slide


  16. ։ൃϘʔυ
    ηϯαʔ

    View full-size slide

  17. ιϑτ΢ΣΞ

    View full-size slide

  18. "O0QFSBUJOH4ZTUFNGPSDPNNFSDJBMDPOOFDUFE
    QSPEVDUT
    4VQQPSUFENJDSPDPOUSPMMFST$$ $$
    &41 &41

    View full-size slide

  19. .POHPPTF04ͷॻ͖ࠐΈ
    curl -fsSL https://mongoose-os.com/downloads/mos/install.sh | /bin/bash
    ~/.mos/bin/mos --help
    ~/.mos/bin/mos
    %PDVNFOUIUUQTNPOHPPTFPTDPNTPGUXBSFIUNM

    View full-size slide

  20. %FNP
    d.POHPPTF04ͷΤσΟλը໘ىಈd

    View full-size slide

  21. ίʔσΟϯά
    ϒϥ΢βͷΤσ
    Ολը໘Ͱίʔσ
    Οϯά

    View full-size slide

  22. ίʔσΟϯά
    ʲ4BWF3FCPPUʳͰσϓϩΠ

    View full-size slide

  23. %FNP
    dιʔείʔυͷσϓϩΠd

    View full-size slide

  24. %FNP
    (SPWF#VUUPO
    $MJDL͢Δͱl$MJDLFEz͕ग़ྗ͞ΕΔ

    View full-size slide

  25. ࠓ೔࿩͢͜ͱ
    w ϋʔυ΢ΣΞ
    w ιϑτ΢ΣΞ
    w Πϯλʔωοτʹܨ͙
    w ޻࡞ྫ
    w ·ͱΊ
    5IJOHT
    *OUFSOFU

    View full-size slide

  26. Πϯλʔωοτʹܨ͙

    View full-size slide

  27. load('api_config.js');
    load('api_http.js');
    load('api_gpio.js');
    load('api_timer.js');
    let button = 25;
    GPIO.set_button_handler(button, GPIO.PULL_UP, GPIO.INT_EDGE_NEG, 200,
    function() {
    print("clicked!");
    HTTP.query({
    url: 'https://maker.ifttt.com/trigger/esp32/with/key/{your-key}',
    headers: { },
    data: {
    event: 'esp32',
    message: 'clicked!',
    timestamp: Timer.now()
    },
    success: function(body, full_http_msg) { print(body); },
    error: function(err) { print(err); },
    });
    }, null);

    View full-size slide

  28. %FNP
    d.POHPPTF04Ͱ*'5558FCIPPLTΛ
    ୟ͍ͯ1VTI௨஌ 1VTI#VMMFU
    Λड͚औΔd

    View full-size slide

  29. DBMM8FCIPPLT63- DBMM&WFOU

    View full-size slide

  30. ΞΠσΟΞྫ
    1*3ηϯαʔʷ
    ˠࣗಈͰর໌Λ఺౮ফ౮
    ߱Ӎηϯαʔʷ
    ˠӍ͕߱ͬͨΒ4MBDLϝϯγϣϯ
    Ξϧίʔϧηϯαʔʷ
    ˠҿΈա͗ΛπΠʔτʢʁ

    View full-size slide

  31. ·ͱΊ
    w ϋʔυ΢ΣΞͷηοτΞοϓɹˠ։ൃϘʔυΛ࢖͏
    w ιϑτ΢ΣΞͷηοτΞοϓɹˠ*P5ಛԽܕ04ʹ೚ͤΔ
    w 4%,ͷηοτΞοϓɹˠ*'555

    View full-size slide

  32. خ͍͜͠ͱ
    ։ൃ؀ڥͷηοτΞοϓͱ
    ίʔσΟϯάΛ࠷খݶʹͯ͠
    ΞΠσΟΞʹूதͰ͖Δ

    View full-size slide

  33. ·ͱΊ
    w +BWB4DSJQU*P5͸ϓϩτλΠϐϯάʹ࠷ద
    w ηϧϑ*P5Ͱੜ׆Λศརʹ͍ͯ͜͠͏

    View full-size slide