An open API service indexing awesome lists of open source software.

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

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