# 接続確認
adb devices
# 繋げる
adb shell
# gpio
cd /sys/class/gpio
# i2c2番ポート調べる
i2cdetect -yr 2
- 入力/出力の切り替え
- out/in/high/lowの4種類が設定が可能
- valueファイルではデータの取得と設定を行います。valueの値は,0と1でそれぞれlowとhighを意味
- in
- 読み込み
- out
- 書き込み
# 接続確認
adb devices
# 繋げる
adb shell
# gpio
cd /sys/class/gpio
# i2c2番ポート調べる
i2cdetect -yr 2
人感センサー
window.addEventListener('load', function (){
navigator.requestGPIOAccess().then(
function(gpioAccess) {
console.log("GPIO ready!");
return gpioAccess;
}).then(gpio=>{
var port = gpio.ports.get(197);
return port.export("in").then(()=>{
port.onchange = function(value) {
console.log('port onchange: ', value);
}
});
}).catch(error=>{
console.log("Failed to get GPIO access catch: " + error.message);
});
}, false);