2015-01-14 11:41:43 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
|
*
|
2019-05-09 09:47:11 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-01-14 11:41:43 +00:00
|
|
|
*/
|
|
|
|
|
|
2017-02-23 00:57:19 -06:00
|
|
|
"use strict";
|
2015-01-14 11:41:43 +00:00
|
|
|
|
2017-02-23 00:57:19 -06:00
|
|
|
const mraa = require('mraa'); //require mraa
|
2015-01-14 11:41:43 +00:00
|
|
|
|
2017-02-23 00:57:19 -06:00
|
|
|
let spiDevice = new mraa.Spi(0);
|
|
|
|
|
let buf = new Buffer(4);
|
|
|
|
|
buf[0] = 0xf4;
|
|
|
|
|
buf[1] = 0x2e;
|
|
|
|
|
buf[2] = 0x3e;
|
|
|
|
|
buf[3] = 0x4e;
|
|
|
|
|
let buf2 = spiDevice.write(buf);
|
|
|
|
|
console.log("Sent: " + buf.toString('hex') + ". Received: " + buf2.toString('hex'));
|