These are, properly speaking, called methods and properties. All the examples assume the Dragonfly object was created using:
dim df set df = CreateObject( "Dragonfly.Help" )
6-a) Functions to handle the relays and read the sensors
| Function | Description | Example(s) |
|---|---|---|
RelayOpen( relayNumber ) | Opens the given relay | df.RelayOpen(1) |
RelayClose( relayNumber ) | Closes the given relay | df.RelayClose(1) |
RelayChange( relayNumber ) | Changes the relay status: opens it if closed and closes it if open; if configured as a pulsed relay, it will pulse following that configuration. | df.RelayChange( 3 ) |
RelayPulse( relayNumber, period ) | Pulses the given relay for the specified number of milliseconds. Pulses it regardless of the control panel configuration. | Call df.RelayPulse( 2, 1500 ) |
RelayRead( relayNumber ) | Reads if the given relay is energized / closed (TRUE) or not (FALSE) | If df.RelayRead( 1 ) then ... |
SensorDigRead( sensorNumber ) | Reads the given sensor digitally, that is, returns TRUE or FALSE. | If df.SensorDigRead( 2 ) then ... |
SensorAnRead( sensorNumber ) | Reads the given sensor analog, that is, returns a number between 0 and 1024. | If df.SensorAnRead( 3 ) < 524 then... |
6-b) Functions to control the log output
These are useful to know what's going on!
| Function | Description | Example(s) |
|---|---|---|
LogShow | Shows the log window | df.LogShow |
LogHide | Hides the log window | df.LogHide |
LogClear | Erases the log window contents | df.LogClear |
LogAddLine( text ) | Adds the given line to the log window | df.LogAddLine( "Closing the roof!" ) |
LogAddToLine( moreText ) | Appends the given text to the last written line | df.LogAddLine( "... closed" ) |
LogUpdateLine( newtext ) | Changes the contents of the last line of text | df.LogUpdateLine( "Problem closing the roof" ) |
LogSetBold( TRUE or FALSE ) | Sets or unsets the last line as bold characters | df.LogSetBold( true ) |
LogSetForeColor( color ) | Sets the color of the text written in the last line | df.LogSetForeColor( &H0FF& ) |
LogSetBackColor( color ) | Sets the background color of the text written in the last line | df.LogBackForeColor( &H0FF& ) |
The colors are RGB values, expressed as hexadecimal values, in this way: &H00BBGGRR&. Very much like with a 3-colour astroimage. Values go from 00 to FF, &H00FF0000& being a 100% blue colour, &H0000FF00& a 100% green one, etc.
6-c) The only ASCOM function—report the status of the roof
| Function | Description | Example(s) |
|---|---|---|
AscomShutterStatus( status ) | Sets or reads the status of the shutter—this is accessible to other ASCOM programs. | df.AscomShutterStatus = 2 |
6-d) Advanced functions for asynchronous scripts
These are most likely not needed.
| Function | Description | Example(s) |
|---|---|---|
timer( timerNumber ) | Reads or sets a countdown timer in milliseconds. Will stop counting when ≤ 0. It also sets "timerActive( timerNumber )" to TRUE—but will not set it to FALSE when 0 is reached! | Timer( 1 ) = 5000 |
timerActive( timerNumber ) | Gets or sets the active status of a given timer. Set to TRUE if the timer is started to count. | TimerActive( 1 ) |
flag( flagNumber ) | User flag; can be read or written, to true or false. | Flag( 3 ) = TRUE |
UserVar( varNumber ) | Same as flags, but with integer (numeral) values. | UserVar( 7 ) = 435 |
Please take a look at the included sample scripts (explore your software folder, "dfscripts", for a "samples" folder) for well-documented, clearly written ones.
