Sophisticated Power On\Off button using JavaScript

213 views
Skip to first unread message

Nahshon Williams

unread,
Feb 6, 2012, 5:14:50 PM2/6/12
to comman...@googlegroups.com
Ok I now would like to try some Javascript (been avoiding her like the
plague)
Toddler steps would be great:

So:
Need a power on button that queries the unit for the current power state:

Objective:
If unit is on: change button state to "Unit ON". Set next button press
command to: Power Off
If unit is off: change button state to "Unit OFF". Set next button
press command to: Power On


Commands and Feedback:

Query Power state of Arcam: \x21\x01\x00\x01\xF0\x0D

Arcam On: \x21\x01\x00\x00\x01\x01\x0D
Arcam Off:\x21\x01\x00\x00\x01\x00\x0D

Regex: .*\x21\x01\x00\x00\x01(\x00)?(\x01)?\x0D.*

Power On Command: \x21\x01\x08\x02\x10\x7B\x0D
Power Off command: \x21\x01\x08\x02\x10\x7C\x0D

Where do I start?
Any thoughts welcome
Nahshon

Jarrod Bell

unread,
Feb 10, 2012, 7:57:28 AM2/10/12
to comman...@googlegroups.com
Try this (untested):

https://gist.github.com/1789532

Jarrod

Nahshon

unread,
Feb 12, 2012, 6:08:01 AM2/12/12
to CommandFusion
Thank you Jarrod,
I will try this today and let you know.
This will be my temple (meant template) for building future code as it
is basic decision and action.
Nahshon
Reply all
Reply to author
Forward
0 new messages