# 藝術家的復古 vhs 播放裝置規劃 ## 討論 Crontab 準備好執行 播放影片.py 用 python 寫播放影片.py 會用到 RPi.GPIO 模組 subprocess 命令 vlc if/else 與迴圈進行控制 感應器: 按鍵 光敏電阻或微動開關帶長臂 按快轉鍵=播放下一影片? 需要播放完自動跳起播放鍵? 開關可沿用 原開關(重焊兩條線) 指示燈可用杜邦2.5線接 原LED小板 ### 操作互動流程 ```flow st=>start: 取得錄影帶 op=>operation: 打開錄影機開關 op2=>operation: 打開錄影機蓋子 op3=>operation: 放入錄影帶 op4=>operation: 按下播放鍵 op5=>operation: 打開電視 op6=>operation: 播放影片 op7=>operation: 播放完畢,停止鍵按下 op8=>operation: 打開錄影機蓋子 op9=>operation: 取出錄影帶 op10=>operation: 關閉錄影帶開關 op11=>operation: 關閉電視 e=>end: 歸還錄影帶 st->op->op2->op3->op4->op5->op10->op6->op7->op8->op9->op10->op11->e ``` ### 程式運作 ```flow st=>start: 開始 cond=>condition: 電源開關 cond1=>condition: 錄影帶感應器 cond2=>condition: 影片播放開關 op=>operation: 影片播放 op1=>operation: 播放結束 op2=>operation: 停止鍵跳起 e=>end: 結束 st->cond(yes)->cond1(yes)->cond2(yes)->op->op1->op2->e ``` [伴伴學專案: 改造VHS播放器](https://hackmd.io/FkEvuWUhQpywec1c94JSbQ?view) ## 參考資料 工具 Linux 系統上使用 crontab 工作排程,設定讓系統定時自動執行指定的指令或程式。 [Python bindings](https://wiki.videolan.org/python_bindings) [Raspberry Pi GPIO Interrupts Tutorial](https://roboticsbackend.com/raspberry-pi-gpio-interrupts-tutorial/) [How to debounce Push Button in Raspberry Pi 4](https://roboticadiy.com/how-to-debounce-push-button-in-raspberry-pi-4/) [classgpiozero.Button](https://gpiozero.readthedocs.io/en/stable/api_input.html) [Python VLC MediaPlayer – Start Playing it](https://www.geeksforgeeks.org/python-vlc-mediaplayer-getting-current-state/?ref=rp) [How to play video with python-vlc?](https://stackoverflow.com/questions/67850388/how-to-play-video-with-python-vlc) https://hackmd.io/FkEvuWUhQpywec1c94JSbQ?view