転倒検知センサー ISOKS

Created Date: 2015-11-27/ updated date: 2018-03-13
Owner & Collaborators
License
Summary

Memo

main.js

posted by Yamato-Ikeda on November 27, 2015
'use strict';

window.addEventListener('load', function (){
  function Sleep(millisec) {
    var start = new Date();
    while(new Date() - start < millisec);
  }

  navigator.requestI2CAccess().then(
    function(i2cAccess) {
      var port = i2cAccess.open(0);
     
      setInterval(function(){
        SRF02.read(port,0x70).then(value => {
          console.log(value)
          document.getElementById("debug").innerHTML = value+"cm";
        });
      },700);
      /*転倒検知プログラム作成中*/
    },
    function(error) {
      console.log(error.message);
    }
  );
}, false);

Comments