Nick:I have some bonescript code that works with the UART, but I'm not using the built-in bonescript calls. It works fine with a GPS, though I don't use it to transmit.I took would like to see an example that uses the bonescript calls.
Before ruing the code you need to:beagle# npm install -g serialport
beagle# echo BB-UART4 > /sys/devices/bone_capemgr.*/slots
I tried to use this example to write to a device I have connected to serial port /dev/ttyO1. I know the device answers because I can use screen and get responses. My code to send out "/sh/s" is:
var b = require('bonescript');
var cmd = '/sh/s';
var port = '/dev/ttyO1';
var options = {
baudrate: 9600
};
b.serialOpen(port, options, onSerial);
b.serialWrite(port, cmd);
function onSerial(x) {
if (x.err) {
console.log('***ERROR*** ' + JSON.stringify(x));
}
if (x.event == 'open') {
console.log('***OPENED***');
}
if (x.event == 'data') {
console.log(String(x.data));
}
}
I get the following response:debian@beaglebone:~/nodews$ node shedrd.js
/usr/local/lib/node_modules/bonescript/my.js:55
var slotRegex = new RegExp('\\d+(?=\\s*:.*,bs.*' + pin.key + ')',
^
TypeError: Cannot read property 'key' of undefined
at Object.exports.load_dt (/usr/local/lib/node_modules/bonescript/my.js:55:67)
at Object.newFunction [as serialOpen] (/usr/local/lib/node_modules/bonescript/my.js:228:25)
at Object.<anonymous> (/home/debian/nodews/shedrd.js:8:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
debian@beaglebone:~/nodews$
Thanks for the helpJonathan
On Monday, April 7, 2014 1:13:13 PM UTC-4, Jason Kridner wrote:
Is that /dev/tty oh one /dev/tty zero one
--Mark
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/beagleboard/r1jMChzokaM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
var b = require('bonescript');
var cmd = '/sh/s';
var port = '/dev/ttyO1';
var options = {
baudrate: 9600
};
b.serialOpen(port, options, onSerial);
b.serialWrite(port, cmd);
function onSerial(x) {
if (x.err) {
console.log('***ERROR*** ' + JSON.stringify(x));
}
if (x.event == 'open') {
console.log('***OPENED***');
}
if (x.event == 'data') {
console.log(String(x.data));
}
}
debian@beaglebone:~/nodews$ node shedrd.js
/usr/local/lib/node_modules/bonescript/my.js:55
var slotRegex = new RegExp('\\d+(?=\\s*:.*,bs.*' + pin.key + ')',
^
TypeError: Cannot read property 'key' of undefined
at Object.exports.load_dt (/usr/local/lib/node_modules/bonescript/my.js:55:67)
at Object.newFunction [as serialOpen] (/usr/local/lib/node_modules/bonescript/my.js:228:25)
at Object.<anonymous> (/home/debian/nodews/shedrd.js:8:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
debian@beaglebone:~/nodews$
Hi All,I am a new bee in BBB too, but have some knowledge about the serial device and data-acquisition. I have read all the emails below, and understood the code. The problem is the command to link the UART4 to /dev/tty failed.debian@beaglebone:/var/lib/cloud9$ echo BB-UART4 > /sys/devices/bone_capemgr9/slots
bash: /sys/devices/bone_capemgr9/slots: No such file or directory
Cannot find the bone_capemgr in the /sys/devices in this board. Please advice.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/c5d7fc58-966c-44c0-ac67-2d9c3d5a6590%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/r1jMChzokaM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CA%2BT6QPk4j3Ks%2BwSFsMtVCvfRftMdwqjoTSRZxk40Q2O%3DA8Ms3A%40mail.gmail.com.