该项目演示了使用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中文网其他相关文章!