該項目演示了使用Arduino,Node.js和AppleScript構建的MAC遙控器。 它允許用戶控制其Mac的捲,iTunes播放列表播放和靜音功能。
>密鑰功能:
>軟件(Node.js Server):
node.js服務器使用
代碼定義了:>的函數
johnny-five
:將命令發送到iTunes(播放,停止)。 child_process
const five = require('johnny-five'); const exec = require('child_process').exec; // ... (rest of the code remains largely the same, with minor stylistic changes) ...
askiTunes(command)
:檢索當前卷設置。 setVolumeLevel(level)
toggleMute()
使用的applescript命令是簡潔且針對性的:getVolumeLevels()
tell application "iTunes" to play playlist "Top 25 Most Played"
tell application "iTunes" to stop
set volume output volume [level]
set volume with/without output muted
>啟動應用程序(get volume settings
打開Finder Windows(>文本對語音()
安裝和用法:npm install johnny-five serialport
>
node index.js
驗證Arduino連接和標準firmata上傳。
以上是用node.js和arduino遠程控制您的Mac的詳細內容。更多資訊請關注PHP中文網其他相關文章!