S.)
Say( text to speech ) Speaks the text that is specified within the brackets out of the PC Sound Card in the background. This command does not block, the script will continue to execute. Example: Say("Hello, I am a robot")
SayWait( text to speech ) Speaks the text that is specified within the brackets out of the PC Sound Card and blocks until done speaking. Example: SayWait("Hello, I am a robot")
SayEZB( text to speech ) Speaks the text that is specified within the brackets out of the EZ-B v4 speaker in the background. This command does not block, the script will continue to execute. Example: SayEZB("Hello, I am a robot")
SendSerial( digitalPort, baudRate, data, ... ) Send a series of data over the specified port and baud rate Data can be Hex (0x09), string ("string"), or decimal (188) Example: SendSerial(d0, 9600, 0x00, 0x04, 0x05) Example: SendSerial(d0, 9600, 244, 200, a) Example: SendSerial(d0, 9600, "This is text") Example: SendSerial(d0, 9600, Hello + $name)
SendUDP( hostname, port, data, ... ) Send a series of UDP data over the specified port to the hostname Data can be Hex (0x09), string ("string"), or decimal (188) Example: SendUDP(192.168.0.1, 21, Hello World) Example: SendUDP(192.168.0.1, 21, 0x20, 0x21, 0x22, 0x30) Example: SendUDP(192.168.0.1, 21, 0x20, 0x21, 0x22, Hello) Example: SendUDP(192.168.0.1, 21, 0x20, 0x21, 0x22, 0x30, $x)
SetBits( bit7, bit6, bit5, bit4, bit3, bit2, bit1, bit0 ) Returns the value of each bit of a byte. Returns a decimal number byte of the bits. This is a useful function for i2c communication because many of the i2c devices use bits. Example: $val = SetBits(1, 0, 0, 0, 0, 0, 0, 0) Example: $val = SetBits(true, false, false, false, false, false, false, false)
SetSpeed( speed, [speedRight] ) Sets the global Movement Speed value If you specify only one parameter, the speed of both the left and right wheel will be modified If you specify two parameters, the first parameter is the speed of the Left wheel and second parameter is the speed of the Right wheel. The speed can be viewed in the Script Variable Viewer Speed is between 0 (slow) and 255 (fast) Example: SetSpeed(50) Example: SetSpeed(50, 100)
SetSpeedLeft( speed ) Sets the global Movement Speed value of the Left wheel Speed is between 0 (slow) and 255 (fast) The speed can be viewed in the Script Variable Viewer Example: SetSpeedLeft(50)
SetSpeedRight( speed ) Sets the global Movement Speed value of the Right wheel Speed is between 0 (slow) and 255 (fast) The speed can be viewed in the Script Variable Viewer Example: SetSpeedRight(50)
StopEZBAudio() Stops any audio background that is being streamed through the EZ-B v4 Example: StopEZBAudio()
SayEZBWait( text to speech ) Speaks the text that is specified within the brackets out of the EZ-B v4 speaker and blocks until done speaking. Example: SayEZBWait("Hello, I am a robot")
Servo (servoPort, position) Move servo to the specified position Servo position is between 1 and 180 Example: Servo(D14, 25)
ServoDown (servoPort, count) Decrement the servo position value by specified count Servo position is between 1 and 180 Example: ServoDown(D14, 1)
SetServoMax (servoPort, position) Set the maximum limit that this servo can ever move to Servo position is between 1 and 180 Example: SetServoMax(D14, 100)
SetServoMin (servoPort, position) Set the minimum limit that this servo can ever move to Servo position is between 1 and 180 Example: SetServoMin(D14, 40)
SetVolume( volume ) Sets the volume of the EZ-B v4 speaker The volume can be a value between 0 (quite), 100 (loud), 200 (2x over drive) The volume can be viewed in the Script Variable Viewer Example: SetVolume(50) Example: SetVolume(100) Example: SetVolume(150)
ServoRandom (servoPort, lowPosition, highPosition) Move the servo to a random position between low and high Servo position is between 1 and 180 Example: ServoRandom(D14, 10, 20)
ServoSpeed (servoPort, speed) Set the speed of servo or PWM. This is the speed to move between positions. The servo speed is a number between 0 (fastest) and 10 (slowest) *Note: To initialize the ServoSpeed() at first use, set a Servo() position before using the ServoSpeed() command. If there is no previous position (such as during power-on), the software assumes the position is 0 and will cause issues with your robot. *Note: Once the ServoSpeed() has been initialized the first time, specify the ServoSpeed() before specifying the Servo() position. Example: ServoSpeed(D14, 25)
ServoSpeedRandom (servoPort, lowSpeed, highSpeed) Set the servo speed or PWM to a random value The servo speed is a number between 0 (fastest) and 10 (slowest) *Note: To initialize the ServoSpeed() at first use, set a Servo() position before using the ServoSpeed() command. If there is no previous position (such as during power-on), the software assumes the position is 0 and will cause issues with your robot. *Note: Once the ServoSpeed() has been initialized the first time, specify the ServoSpeed() before specifying the Servo() position. Example: ServoSpeedRandom(D14, 10, 20)
ServoUp (servoPort, count) Increment the servo position value by specified count Servo position is between 1 and 180 Example: ServoUp(D14, 1)
Servo_Wait ( digitalPort, higher/lower/equals, value ) Wait until the servo Port is higher or lower than specified value. Zero can be specified as a value for a stopped servo. Example: Servo_Wait(D5, HIGHER, 20)
Set (digitalPort, on/off/true/false) Set a digital port state to either on or off Example: Set(D2, OFF)
SetRandom (digitalPort) Set a digital port to a random state of either on or off Example: SetRandom(D2)
ShowControl( ControlName ) Used for mobile devices and the Interface Builder only, this command will open the specified control into the foreground. Example: ShowControl(Wii Remote)
ShowDesktop( desktopNumber ) Shows the specified virtual desktop. The desktop number is 1, 2 or 3. Example: ShowDesktop(1)
Sin( value ) Returns the math SIN() function Example: $x = Sin(27)
Sleep (milliseconds) Pauses for specified milliseconds Example sleeps for 1 second: Sleep(1000)
SleepPC( Suspend|Hibernate, force, wake ) Sends a command to the operating system to sleep or hibernate. If Force is TRUE, the computer is forced to sleep and other applications have no say in the decision. If Wake is TRUE, the computer will wake up on Wake events. Example: SleepPC( Suspend, true, true ) Example: SleepPC( Hibernate, true, true )
SleepRandom (lowMilliSec, highMilliSec) Pauses for a random millisecond delay between the 2 provided values Example: SleepRandom(1000, 5000)
SoundNote( note, lengthMS, [signal type] ) Plays the specified audio note out of the EZ-B v4 speaker for the specified number of milliseconds. Optionally, you may provide a signal type as well. The valid signal types are Sine, Square, Triangle, Pulse, Sawtooth, WhiteNoise, GaussNoise, DigitalNoise. Example: SoundNote( C2, 1000) Example: SoundNote( C2, 1000, Square)
SpeakRSS( url, [story index] ) Speaks the title and text of the rss url out of the PC Sound Card. Example #1: SpeakRSS("http://rss.cbc.ca/lineup/world.xml") Example #2: SpeakRSS("http://rss.cbc.ca/lineup/world.xml", 3)
SpeakRSSDescription( url, [story index] ) Speaks only the text of the rss url out of the PC Sound Card. Example #1: SpeakRSSDescription("http://rss.cbc.ca/lineup/world.xml") Example #2: SpeakRSSDescription("http://rss.cbc.ca/lineup/world.xml", 3)
SpeakStop( ) Stops speaking the current specified phrases out of the PC Sound Card. Example: SpeakStop()
SpeakTwitter( twitterUserName, [story index] ) Speaks the twitter feed for the specific username out of the PC Sound Card. Example #1: SpeakTwitter("EZ_Robot") Example #2: SpeakTwitter("EZ_Robot", 3)
SpeakVolume( value ) The volume of the speech synthesizer out of the PC Sound Card. The value is between 0 and 100 Example: SpeakVolume(30)
Split( text, splitChar, index ) Splits a line of text by the specified SplitChar into an array and returns the Index. The Index is zero based, which means 0 (zero) is the first item within the array. Example: $contents = Split(One, Two, Three, ,, 1) Example: $contents = Split(One - Two - Three, -, 2)
Stop() Using Movement Panel Control, this will stop your robot. You will require at least one Movement Panel to be configured within the project. This function will control a movement panel. Example: Stop()
StopAudio() Stops the current audio file that is playing through the default audio device by PlayAudio() Example: StopAudio()
Sqrt( value ) Returns the math Square Root function Example: $x = Sqrt(9)
SubString( string1, start, length ) Returns the specified substring within string1. Example: $value = SubString(Cat In The Hat, 4, 2)
References
Servo/Digital Ports These ports are used to turn on and off devices with voltage. The digital ports can also be used for detecting if the input voltage is in an On or Off state. For output, the digital ports may control servos, transmit PWM (Pulse Width Modulation) and send serial data. Consult the Learn Section of our website for more information on the different modes of Digital Port Types. D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23
Scientific Math Functions Sin() Cos() Tan() Sec() Csc() Cot() ASin() ACos() ATan() SinH() CosH() TanH() Abs() Sqrt() Ciel() Floor() Exp() Log10() Log() Max() Min() Round() E() Pi() Now() Today()