All Tutorials / Steve G / The EZ-Builder Script Manual.

The EZ-Builder Script Manual.

I.)

If (Value Condition Value )
IF condition can support multiple comparisons and functions.
Condition tree must be closed with an ENDIF
See the Functions section of this document.
Condition can be =, , =, !=, AND, OR
Example:
If (GetDigital(D0) = 1)
Print(“One”)
EndIf
Example:
If ($Day = 2 AND $Hour = 3)
Print(“Hello”)
EndIf
Example:
If (GetServo(D5) >20 OR ($x >= 3 and $y , =, !=, AND, OR
Example:
If (GetServo(D0) = 1)
Print(“One”)
ElseIf (GetServo(D0) = 2)
Print(“Two”)
Else
Print(“Something Else”)
EndIf

IndexOf( string1, string2 )
Returns the index within string1 of the first occurrence of string2.
This search is case insensitive.
Example: $value = IndexOf(“Cat In The Hat”, “In”)

IsConnected( boardIndex )
Returns TRUE or FALSE if the specified EZ-B board index is connected
Example: $status = IsConnected(0)

IsNumeric( value )
Returns True or False if the specified value is numeric.
Example: $value = IsNumeric($x)

I2CClockSpeed( boardIndex, rate )
Specify the clock speed of the i2c interface. The default speed is 100000, which is 100khz.
Many devices support faster speeds, up to 400000 (400khz).
Example: I2CClockSpeed(0, 100000)
Example: I2CClockSpeed(0, 400000)

I2CRead( boardIndex, 7bitDeviceAddress, bytes to expect )
Returns a series of ASCII data from the specified address over the i2c interface
boardIndex is the EZ-B you wish to use (0 is first EZ-B)
Device Hex Address must be hexadecimal 7Bit (0x5e)
You must specify the number of Bytes To Expect
Example: $Val = I2CRead(0, 0x5e, 2)

I2CReadBinary( boardIndex, 7bitDeviceAddress, bytes to expect, variable )
Returns a series of binary data from the specified address over the i2c interface into the specified variable array
boardIndex is the EZ-B you wish to use (0 is first EZ-B)
Device Hex Address must be hexadecimal 7Bit (0x5e)
You must specify the number of Bytes To Expect
Example: I2CReadBinary(0, 0x5e, 2, $variable)

I2CWrite( boardIndex, deviceAddress, data, .... )
Send a series of ASCII data to the specified device hex address over the i2c interface.
This command will Start i2c, Write Data, and Stop i2c.
boardIndex is the EZ-B you wish to use (0 is first EZ-B)
Device Hex Address of i2c device must be in 0x00 format.
Data can be Hex (0x09), string ("string"), or decimal (188)
Example: I2CWrite(0, 0x09, 0x02, 0x05, 0x06)
Example: I2CWrite(0, 0x09, 244)
Example: I2CWrite(0, 0x09, "This is text “ + $variable)

I2CWriteBinary( boardIndex, deviceAddress, variable )
Send a series of binary data to the specified device hex address over the i2c interface from the provided variable array.
This command will Start i2c, Write Data, and Stop i2c.
boardIndex is the EZ-B you wish to use (0 is first EZ-B)
Device Hex Address of i2c device must be in 0x00 format.
Variable is an array with data that you wish to send
Example: I2CWriteBinary(0, 0x09, $variable)