Last active
February 10, 2016 20:22
-
-
Save chintanp/3c8efb788e1cb80c505d to your computer and use it in GitHub Desktop.
The node implementation to interact with ELCON charger over CANBus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var can = require('socketcan'); | |
var channel = can.createRawChannel("can0"); | |
// id is the device id, data represents data that has to be written | |
var canmsg = { id: 403105268, data: new Buffer([ 0, 0xFA, 0, 0x32, 0, 0, 0, 0 ]), "ext" : true }; | |
// Log any message | |
//channel.addListener("onMessage", function(msg) { console.log(msg); } ); | |
// Reply any message | |
//channel.addListener("onMessage", channel.send, channel); | |
channel.start(); | |
setInterval(function() { | |
channel.send(canmsg); | |
console.log("Written to CAN device"); | |
}, 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment