Serial Module & data In, manipulating data out?

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
gary uk
Member
Posts: 21
Joined: Tue Dec 02, 2003 9:53 am

Serial Module & data In, manipulating data out?

Post by gary uk »

Hi,



Well as a newbie, I have come along way, I have data being sent in on the serial port correctly!



Can someone please clarify that I can for example have data sent IN on the serial port for example "GB"



Then I wish to change it to say "A1on" and transmit it OUT of the serial port



(Also, but not essential, it would be nice, if after 30secs, to send out "A1off", I suspect this may be trickier as HouseBot would stop processing any more data, while it waits?)



I have read the Help section, but to someone new its a bit confusing, could someone tell me what i have to do?



Regards,





Gary
yaccri
HouseBot Special Member
Posts: 304
Joined: Wed May 07, 2003 2:19 pm
Location: Tel-Aviv, Israel
Contact:

Post by yaccri »

The serial device has a 'Received Data' property.

You need an automatic task (execution mode-when conditions are met) that would compare the 'received data' to what you are expecting ("GB").

I suggest that immediately after that you reset the received data (otherwise you would run into a loop), change the 'send command' to "A1on"", add a 3000 msec delay and change the 'send command to "A1off".



HTH,

Yoram
gary uk
Member
Posts: 21
Joined: Tue Dec 02, 2003 9:53 am

Post by gary uk »

Hi



[The serial device has a 'Received Data' property.

You need an automatic task (execution mode-when conditions are met) that would compare the 'received data' to what you are expecting ("GB").

I suggest that immediately after that you reset the received data (otherwise you would run into a loop), change the 'send command' to "A1on"", add a 3000 msec delay and change the 'send command to "A1off". ]



Where will I find the send command and the delay, are they under a pull down menu somewhere in TASKS ?



Apologies but on a steep learning curve, but its worth it!





Thanks in anticipation



Gary[/quote]
yaccri
HouseBot Special Member
Posts: 304
Joined: Wed May 07, 2003 2:19 pm
Location: Tel-Aviv, Israel
Contact:

Post by yaccri »

OK, we'll take it step by step.



Create a new task (by right clicking the tasks), and name it.

When the task window opens, check the 'Enabled' and the 'When conditions are met' properties.

In the task code below, select "add item..." and a new window will pop-up. Select 'Add condition', select your serial device, the 'Received Data' property leave the 'equal' and in the 'value' textbox put 'GB'.

Select 'Add Item...', 'Add Action' 'Change Property', select your serial device, 'Send Command', ang give it a value of 'A1on'. Click 'OK'.

Select 'Add Item...', 'Add Action' 'Delay', give it a value of '3000' and Click 'OK'.

Select 'Add Item...', 'Add Action' 'Change Property', select your serial device, 'Send Command', ang give it a value of 'A1off'. Click 'OK'.



HTH,

Yoram
gary uk
Member
Posts: 21
Joined: Tue Dec 02, 2003 9:53 am

Post by gary uk »

Hi Yoram



Slight problem!



[OK, we'll take it step by step.



Create a new task (by right clicking the tasks), and name it.

When the task window opens, check the 'Enabled' and the 'When conditions are met' properties.

In the task code below, select "add item..." and a new window will pop-up. Select 'Add condition', select your serial device, the 'Received Data' property leave the 'equal' and in the 'value' textbox put 'GB'.



Select 'Add Item...', 'Add Action' 'Change Property', select your serial device, 'Send Command', ang give it a value of 'A1on'. Click 'OK'. ]



I do not have a 'send command'?



Under Devices, I have my serial device with the following only?

enter text

power state

received data

time



I tried to add a Property but couln't find 'Send Command' only 'send IR command' ?



Where have i gone wrong please?





Regards,





Gary
yaccri
HouseBot Special Member
Posts: 304
Joined: Wed May 07, 2003 2:19 pm
Location: Tel-Aviv, Israel
Contact:

Post by yaccri »

Indeed the serial device is a bit confusing.

I try to recall what I did a few months earlier. Few extra steps are needed:

- Define a new Alpha-Numeric property in the property manager. Name it something like 'Send XYZ Command', where 'XYZ' is your serial device name. Add discrete values to it like 'A1On' and 'A1Off'. Later you may want to change it to use a parameter, but let's try to keep things as simple as possible.

- Add the 'Send XYZ Command' property to the serial device, and name it 'Send Command'.

- In the 'Send Command' property of your serial device, assign values in the 'Commands' tab. If you don't have anything in the 'commands' section, or you need to edit it, look at the 'Command Configuration' part of the Hardware Interface that you are using.



I hope that now nothing is left out.



Yoram.
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

Gary,



You are certainly diving into the deep end for your first HouseBot swim lesson. Effectively configuring an RS232 Interface, Device, and Tasks will give you a healthy introduction to the software.



I've created a small configuraiton sample that recreates what Yoram is explaining. It's said that "A picture is worth a thousand words." I like to think "A configuration sample saves a thousand curse words".



To install the sample, download it from here. Then select "File/Import Configuration..." from the HouseBot main menu. Restart HouseBot and hopefully you will have the following:
  • Imported Devices Device Group with two Devices
  • Sample Serial Device that has a couple of properties
  • Off Command Timer Device
  • Imported Tasks Task Group
  • Handle Off Command Task
  • When GB Received Task
  • When GB Received (better) Task
  • Generic Serial Hardware Interface
Some of these (like the Hardware Interface and Device) will duplicate things that you probably already have configured.



The When GB Received Task is what Yoram is describing and should work fine. The other two tasks are a slightly better way that won't lock the task for 30 seconds (one of your initial questions/concerns).



In addition to the Data To Send Property (aka Send Command), I've also added a Power State Property. You can use either one, but I wanted to give you an example of how the Devices provide an abstraction between the user friendly commands "On" and "Off" and the actual data that is sent "A1on" and "A1off".



I haven't tested this at all, so it may not truly work. It should, hopefully, provide a wired up configuration of what you are trying to do as an example.



Good Luck,

Scott
gary uk
Member
Posts: 21
Joined: Tue Dec 02, 2003 9:53 am

Post by gary uk »

Hi Yoram & Scott,



Just to let you both know, that I now have my program running, and I coudn't have achieved it without your help!



I still have a few things I want it to do, but I will try and do it on my own!



Scott, you are correct "A picture is worth a thousand words." downloading that taught me a lot about HouseBot and how it all works together!



:D



Regards Gary
Post Reply