// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // BV4502 - I2C Relay** NOTE default address on this is 0x62 // This is a library of words inteded for this device it is an I2C // device. The user should set the device address // using the word 4502-default. // This will load as a stand alone file or can be used as a library // providing the parent file includes the files in the REQUIRES // section // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // REQUIRES: // #URL-lib "http://pin1.org/forthlib/flb/General/soft1.flb" sid=0 // #URL-lib "http://pin1.org/forthlib/flb/General/pinsel.flb" sid=101 // #URL-Lib "http://pin1.org/forthlib/flb/I2C/i2c.flb" sid=103 // #URL-Lib "http://pin1.org/forthlib/flb/I2C/bvsys.flb" // CONSTANTS: // device variable is in bvsys.lib // These are simple commands following the device commands. // NOTE: Relay commands 0=on, 1=off : a1 ( -- 0|1 ) device s 1 sb sb p ; // turns relay on/off Relay A : a2 ( -- 0|1 ) device s 2 sb sb p ; // turns relay on/off Relat B // alternet method of addressing // relay number is 1 or 2, on-off is 0 or 1 : relay { number on-off -- } device s number sb on-off sb p ; : 4502-default &62 bv-init i2cfull ;