# This is an example script.
# 
# It illustrates all of script language.
# All commands are sent to address 4, so if you want to actually
# run this script you should have a reciever programmed for address
# 4 on the track.
#
# Each statement is sent repeatedly to give you a chance to
# observe the affect.
#

# Send raw serial port data.
# This data is the equivalent of sending:
# Send Baseline 4 On Forward 5
#
# Note that the data spans two lines - it is perfectly acceptible to continue a
# statement on the next line, and with the send raw statement it is usually
# a good thing to do.
#
repeat 100 times
	Send Raw 0x55 0x55 0x55 0xF0 0xF0 0xF0 0xF0 0xF0 0x78 0xF0 0xF0
	         0xF0 0x56 0x78 0x78 0xF0 0x56 0xF0 0xF0 0x56 0xF0 0xF0
endrepeat


# Send a basic packet.
# This data is the same as:
# Send Baseline 4 On Forward 5
#
repeat 100 times
	Send 0b00000100 0b01110100 0b01110000
endrepeat

# stop for a while.
repeat 100 times
	Send Baseline 4 On Forward stop
endrepeat

# Send an xor packet.
# The data is the same as:
# Send Baseline 4 On Forward 5
#
repeat 100 times
	Send XOR 4 0x74		# Comments can also occur at the ends of lines!
endrepeat

# stop for a while.
repeat 100 times
	Send Baseline 4 On Forward stop
endrepeat

# Send a baseline packet.
# The headlights are on, forward speed 5.
Repeat 100 Times
	Send Baseline 4 On Forward 5
EndRepeat

# Now accelerate to speed 12.
Repeat 100 Times
	Send Baseline 4 On Forward 12
EndRepeat

# Do an emergency stop, which must be followed by a speed 0 to really stop.
Send Baseline 4 On Forward emergencystop
Send Baseline 4 On Forward stop

# wait for a while.
repeat 100 times
	Send Baseline 4 On Forward stop
endrepeat

# Now go forward with the light on, and backward with it off 4 times
repeat 4 times
	# forward, light on.
	repeat 100 times
		Send Baseline 4 On Forward 5
	endrepeat
	# stop and wait a while with the light off.
	repeat 100 times
		Send Baseline 4 off Forward stop
	endrepeat
	# reverse, light off.
	repeat 100 times
		Send Baseline 4 off reverse 5
	endrepeat
	# stop and wait a while with the light off.
	repeat 100 times
		Send Baseline 4 off Forward stop
	endrepeat
endrepeat
