I am at a loss trying to figure out what i am doing wrong, again! Trying to send a hex command (0x02) out the extender serial port 4, wait for a responce which should be 0x06 0x0D (ACK) or 0x15 (NAK). I would then like to write the responce to a label named 'status'. Im using Barry's Debugger but nothing shows up after the download and jumping to the page. Here is the code. This is being executed in the "HOME" activity, "ROOM" page, 'status' panel.
var debug = true;
System.setDebugMask(debug ? 9 : 0);
CF.widget("status").label = "No Responce";
var e,s;
e = CF.extender[0];
if (!e)
{
System.print("Extender 0 is not defined");
}
else
{
s = e.serial[3];
if (!s)
{
System.print("Extender 0 is not a serial extender");
}
else
{
s.bitrate = 9600;
s.databits = 8;
s.parity = 0;
s.stopbits = 1;
}
}
s.onData = function (v) {status = v;};
s.match("\x02","\x06\x0D",250);
s.onTimeout = function(v) {
System.print("Smarthome timeout");
}
s.onError = function(e) {
System.print("Smarthome " + e);
}
Last edited by pjjameso on June 13, 2010 09:58.