https://github.com/zuki/raspible_mac
RasPiとMacをつないでLチカ
https://github.com/zuki/raspible_mac
Last synced: 12 months ago
JSON representation
RasPiとMacをつないでLチカ
- Host: GitHub
- URL: https://github.com/zuki/raspible_mac
- Owner: zuki
- Created: 2019-07-01T06:18:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-01T06:23:24.000Z (almost 7 years ago)
- Last Synced: 2025-06-14T16:51:46.457Z (about 1 year ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RasPiとMac/ChromeをBLEでつないでLチカ
## インストール
### RasPi側
[pybleno](https://github.com/Adam-Langley/pybleno)をインストールする
```bash
# 必要なパッケージのインストール
# [bleno](https://github.com/noble/bleno#prerequisites)による
$ sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
# bluetoothd の停止
$ sudo systemctl stop bluetooth # とりあえず今回だけ
# $ sudo systemctl disable bluetooth # 起動時にも停止
# hci0のマニュアル起動
$ sudo hciconfig hci0 up
# pybleno のインストール
$ pip install pybleno
```
### Mac側
[BlueJelly](https://github.com/electricbaka/bluejelly.git)をインストールする
```bash
$ git clone https://github.com/electricbaka/bluejelly.git
```
## 操作方法
### RasPi側
1. ペリフェラルを立ち上げる
```
$ cd /home/pi/examples/ble_switch
$ sudo ./peripheral.py
```
### Mac側
1. 「設定」でBluetoothを有効化
2. `Chrome` を立ち上げる
3. `file:///Users/dspace/source/bluejelly/src/notify.html`に接続
4. [Start Notify] ボタンを押して接続
5. スイッチのオンオフでLEDがオン・オフし、`read data`値が変更される
6. [Stop Notify] ボタンを押して切断