如果答案是 "是" 的話,那麼 onoff ( is the Node.js Module ) 就是一個選擇,詳細的說明可以在下面連結中找到:
http://github.com/fivdi/onoff
要使用 onoff,系統的 Node.js 版本必須為 V0.8.0 或更高版本。如果還沒安裝,可以在 Raspbian 安裝 V0.8.14,它運行的很好。
[2012/11/13 更新]
版本 0.1.0 的 Node.je GPIO 函式庫 onoff 已經更新為新版本,更版本做了一些改進:
- 更好的效能
- 同步 (Synchronous) 與非同步 (Asynchronous) 的應用程式介面(API)
- 允許應用程式處理超級用戶的問題
- ...
詳細的 changlog 請上上面的連結看。
下面是截錄於上述 onoff 網站 README.MD 的一段原文,:
Info
onoff has been tested on the BeagleBone (Ångström) and Raspberry Pi (Raspbian). The suitability of onoff for a particular Linux board is highly dependent on how GPIO interfaces are made available on that board. The document describing GPIO interfaces speaks of GPIO access conventions on Linux. The word conventions is important here. For example, onoff relies on sysfs files located at /sys/classes/gpio being available. However, these sysfs files for userspace GPIO are optional and may not be available on a particular platform.
As its name hopefully indicates, onoff can be used for turing things on and off at a "reasonable" frequency. It's not suitable for bit banging.
GPIOs on Linux are identified by unsigned integers. These are the numbers that should be passed to onoff functions.
Node.js 的資訊:
- Syshen's Murmur • 很屌的Node.JS (1) Node.js 的說明與範例 Demo
- NODEJS TAIWAN nodeJS 台灣社群,由一群熱心開發者聚集而成,主力在於蒐集及建立nodeJS 相關中文資訊,提供最佳的學習管道,讓更多人體會javascript 的好處。
- Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
沒有留言:
張貼留言
留言屬名為"Unknown"或"不明"的用戶,大多這樣的留言都會直接被刪除掉,不會得到任何回覆!
發問問題,請描述清楚你(妳)的問題,別人回答前不會想去 "猜" 問題是什麼?
不知道怎麼發問,請看 [公告] 部落格提問須知 - 如何問問題 !