https://github.com/joeferner/node-pi-watchdog
Node wrapper for Raspberry Pi BCM2835 Watchdog
https://github.com/joeferner/node-pi-watchdog
Last synced: 5 months ago
JSON representation
Node wrapper for Raspberry Pi BCM2835 Watchdog
- Host: GitHub
- URL: https://github.com/joeferner/node-pi-watchdog
- Owner: joeferner
- Created: 2014-06-21T13:12:35.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2018-01-19T12:39:00.000Z (over 8 years ago)
- Last Synced: 2025-09-19T05:24:00.296Z (9 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 1
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
pi-watchdog
===========
Node wrapper for Raspberry Pi BCM2835 Watchdog.
Getting Started
---------------
1. Install the Raspberry Pi's watchdog driver
sudo modprobe bcm2708_wdog
sudo nano /etc/modules (add "bcm2708_wdog")
1. (Optional) Change permissions of `/dev/watchdog`
sudo nano /etc/udev/rules.d/60-watchdog.rules
KERNEL=="watchdog", MODE="0666"
1. Install pi-watchdog
npm install pi-watchdog
1. Try the example
node node_modules/pi-watchdog/example.js
Example
-------
```
var piWatchdog = require('pi-watchdog')();
piWatchdog.getTimeout(function(err, timeout) {
console.log(timeout);
});
// enables the watchdog
piWatchdog.setTimeout(function(err, newTimeout) {
console.log(newTimeout);
});
// send heartbeats
setInterval(sendHeartbeat, 5000);
function sendHeartbeat() {
piWatchdog.heartbeat(function(err) {
if(err) {
console.log('heartbeat error', err);
}
});
}
// disable the watchdog
piWatchdog.disable(function(err) {
if(err) {
console.log('heartbeat error', err);
}
});
```
References
----------
* http://binerry.de/post/28263824530/raspberry-pi-watchdog-timer
* https://github.com/binerry/RaspberryPi/blob/master/snippets/c/watchdog/wdt_test.c