JS examples: refactor for clarity and consistent style
Signed-off-by: Kassandra Perch <the@nodebotani.st> Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
This commit is contained in:
committed by
Alex Tereschenko
parent
43d9f6c400
commit
075a7b1225
@@ -24,15 +24,15 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
var m = require('mraa'); //require mraa
|
||||
|
||||
x = new m.Spi(0)
|
||||
buf = new Buffer(4)
|
||||
buf[0] = 0xf4
|
||||
buf[1] = 0x2e
|
||||
buf[2] = 0x3e
|
||||
buf[3] = 0x4e
|
||||
buf2 = x.write(buf)
|
||||
console.log("Sent: " + buf.toString('hex') + ". Received: " + buf2.toString('hex'))
|
||||
"use strict";
|
||||
|
||||
const mraa = require('mraa'); //require mraa
|
||||
|
||||
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'));
|
||||
|
||||
Reference in New Issue
Block a user