vrBot issues.

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
5 postsPage 1 of 1
5 postsPage 1 of 1

vrBot issues.

Post by serithseraki » Thu Feb 20, 2014 10:25 pm

Post by serithseraki
Thu Feb 20, 2014 10:25 pm

I am behind the times but finally bought a vrbot module for my nova and running into some problems. Firstly does the version of robobasic have to be 2.72 as mentioned on the Veear FAQs http://www.veear.eu/faq/? Also, I receive consistent timeout issues, though that may be due to the serial usb adapter. Lastly can any of you provide a working sample code, I know the uploaded template from the GUI needs to be modified for use but the code doesn't look to be generated properly from what I gather from the FAQs "sorry not near my computer to upload my code". Anyway, I am using the default version of robobasic from the disc, would that be my problem?
I am behind the times but finally bought a vrbot module for my nova and running into some problems. Firstly does the version of robobasic have to be 2.72 as mentioned on the Veear FAQs http://www.veear.eu/faq/? Also, I receive consistent timeout issues, though that may be due to the serial usb adapter. Lastly can any of you provide a working sample code, I know the uploaded template from the GUI needs to be modified for use but the code doesn't look to be generated properly from what I gather from the FAQs "sorry not near my computer to upload my code". Anyway, I am using the default version of robobasic from the disc, would that be my problem?
serithseraki offline
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm

Re: vrBot issues.

Post by PaulL » Sat Mar 15, 2014 9:57 pm

Post by PaulL
Sat Mar 15, 2014 9:57 pm

I'm sorry to say, I don't have an answer for you - I'm not familiar with this module - but at least finally here is a reply to your post. :)
I'm sorry to say, I don't have an answer for you - I'm not familiar with this module - but at least finally here is a reply to your post. :)
PaulL offline
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Re: vrBot issues.

Post by ozfiddler » Thu Apr 10, 2014 5:32 am

Post by ozfiddler
Thu Apr 10, 2014 5:32 am

Hi,

Got your message via Youtube but no idea how to reply that way. Below is the final code I used for the combined VRbot and SP03 - hope it's useful for you. Sorry I can't comment on the code you sent me as I did this years ago and it's all just a dim distant memory. I do recall I had to do quite a bit of tweaking to get it to work.

Cheers,

Alan

'================================================
'
' Language recognition with a VRbot and speech with an SP03 to perform basic commands
'
'================================================

' VRbot definitions and routines

GOSUB led_off

CONST RES_ERROR = 255
CONST RES_TIMEOUT = 254
CONST RES_WAITING = 253
CONST RES_BUILTIN = 32

CONST SDA = 46 'Use port 46 for Data, constant SDA
CONST SCL = 47 'Use port 47 for Clock, constant SCL

DIM I2cBuf AS BYTE
DIM I2cAddr AS BYTE
DIM I2cReg AS BYTE
DIM I2cData AS BYTE
DIM I2cBit AS BYTE
DIM I2cTx AS BYTE
DIM I2cRx AS BYTE

' VRA = protocol command/status byte
' VRA1 = first in/out argument
DIM VRA AS BYTE, VRA1 AS BYTE

' VRLED = led status
'DIM VRLED AS BYTE
'VRLED = 1 'off

' main program begins at Startup label
GOTO Startup

CONST CMD_BREAK = &H62 ' abort recog or ping
CONST CMD_SLEEP = &H73 ' go to power down
CONST CMD_KNOB = &H6B ' set si knob <1>
CONST CMD_LEVEL = &H76 ' set sd level <1>
CONST CMD_LANGUAGE = &H6C ' set language <1>
CONST CMD_TIMEOUT = &H6F ' set timeout <1>
CONST CMD_RECOG_SI = &H69 ' do si recog from ws <1>
CONST CMD_RECOG_SD = &H64 ' do sd recog at group <1> (0 = trigger mixed si/sd)

CONST STS_AWAKEN = &H77 ' back from power down mode
CONST STS_ERROR = &H65 ' signal error code <1-2>
CONST STS_INVALID = &H76 ' invalid command or argument
CONST STS_TIMEOUT = &H74 ' timeout expired
CONST STS_INTERR = &H69 ' back from aborted recognition (see 'break')
CONST STS_SUCCESS = &H6F ' no errors status
CONST STS_RESULT = &H72 ' recognised sd command <1> - training similar to sd <1>
CONST STS_SIMILAR = &H73 ' recognised si <1> (in mixed si/sd) - training similar to si <1>

CONST ARG_ACK = &H20

' protocol arguments are IN the range 0x40 (-1) TO 0x60 (+31) inclusive
CONST ARG_MIN = &H40
CONST ARG_MAX = &H60
CONST ARG_ZERO = &H41
CONST ARG_ONE = &H42

' ===== VR routines

' Inputs:
' NONE
VR_Wakeup:
VRA = CMD_BREAK
ETX 9600, VRA
VR_Wakeup1:
ERX 9600, VRA, VR_Wakeup1
IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = timeout (in seconds, 0=forever, 255=default)
VR_SetTimeout:
VRA = CMD_TIMEOUT
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetTimeout1:
ERX 9600, VRA, VR_SetTimeout1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = language index (0 = english, ...)
VR_SetLanguage:
VRA = CMD_LANGUAGE
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetLanguage1:
ERX 9600, VRA, VR_SetLanguage1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = sd strictness level (1=easy ... 5=hard)
VR_SetLevel:
VRA = CMD_LEVEL
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetLevel1:
ERX 9600, VRA, VR_SetLevel1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = si confidence knob (2=typical, 0=loosest ... 4=tightest)
VR_SetKnob:
VRA = CMD_KNOB
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetKnob1:
ERX 9600, VRA, VR_SetKnob1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = wordset (0=trigger)
' Ouputs:
' VRA1 = result (0-31=word, 32..=builtin, 254=timeout, 255=error)
' for trigger N>1 are custom words
VR_RecognizeSI:
VRA = CMD_RECOG_SI
GOTO VR_Recognize0
VR_RecognizeSD:
VRA = CMD_RECOG_SD
VR_Recognize0:
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_Recognize1:
VRA1 = RES_WAITING
RETURN
VR_CheckRecognition:
ERX 9600, VRA, VR_Recognize1
IF VRA = STS_RESULT THEN
VRA = ARG_ACK
ETX 9600, VRA
VR_Recognize2:
ERX 9600, VRA1, VR_Recognize2
VRA1 = VRA1 - ARG_ZERO
ELSEIF VRA = STS_SIMILAR THEN
VRA = ARG_ACK
ETX 9600, VRA
VR_Recognize3:
ERX 9600, VRA1, VR_Recognize3
VRA1 = VRA1 - ARG_ZERO + RES_BUILTIN
ELSEIF VRA = STS_TIMEOUT THEN
VRA1 = RES_TIMEOUT
ELSE
VRA1 = RES_ERROR
ENDIF
RETURN

'================================================
' Main Program

Startup:

' A : temporary variable
' A16,A26 : temporary variable
DIM A AS BYTE
DIM A16 AS BYTE
DIM A26 AS BYTE
DIM V AS BYTE
DIM VOLT AS BYTE
DIM VOLT1 AS BYTE
DIM VOLT2 AS BYTE
DIM WALK AS BYTE

PTP SETON
PTP ALLON

'== motor direction setting ======================
DIR G6A,1,0,0,1,0,0
DIR G6B,1,1,1,1,1,1
DIR G6C,0,0,0,0,0,0
DIR G6D,0,1,1,0,1,0

'== motor start position read ===================
TEMPO 230
'MUSIC "CDE"
GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,1,1,0
'== motor power on =============================
SPEED 5
MOTOR G24
'GOSUB standard_pose
'GOSUB battery

'================================================
DIM VRGROUP AS BYTE
DIM VRCOMMAND AS BYTE

'Groups and Commands

CONST GROUP_0 = 0 '(Command count: 1)

CONST G0_ROBO = 0

CONST GROUP_1 = 1 '(Command count: 11)

CONST G1_STOP = 0
CONST G1_MOVE = 1
CONST G1_HANDS_UP = 2
CONST G1_ROLL = 3
CONST G1_TURN = 4
CONST G1_CLAP = 5
CONST G1_BATTERY = 6
CONST G1_HELLO = 7
CONST G1_HEADSTAND = 8
CONST G1_FLY = 9
CONST G1_ATTACK = 10

CONST GROUP_2 = 2 '(Command count: 4)

CONST G2_LEFT = 0
CONST G2_RIGHT = 1
CONST G2_FORWARD = 2
CONST G2_BACK = 3

CONST GROUP_3 = 3 '(Command count: 4)

CONST G3_LEFT = 0
CONST G3_RIGHT = 1
CONST G3_FORWARD = 2
CONST G3_BACK = 3

CONST GROUP_4 = 4 '(Command count: 3)

CONST G4_LEFT = 0
CONST G4_RIGHT = 1
CONST G4_AROUND = 2

CONST GROUP_5 = 5 '(Command count: 3)

CONST G5_LEFT = 0
CONST G5_RIGHT = 1
CONST G5_FRONT = 2




'start with trigger command group
VRGROUP = 0

'sync with VRbot
GOSUB VR_Wakeup

'Set SI Language
VRA1 = 0
GOSUB VR_SetLanguage

MAIN:
'GOSUB robot_tilt

'start Voice Recognition in current group
VRA1 = VRGROUP
GOSUB VR_RecognizeSD

MAIN1:
'listen for VR commands
GOSUB VR_CheckRecognition
'nothing heard?
IF VRA1 = RES_WAITING THEN
DELAY 400
GOTO MAIN1
ENDIF

'unexpected reply?
IF VRA1 = RES_ERROR THEN
' GOSUB talk_phrase4
GOTO MAIN 'try again in the same group
ENDIF

'timed out?
IF VRA1 = RES_TIMEOUT THEN
' GOSUB talk_phrase5
VRGROUP = 0 ' back to trigger
GOSUB led_off
GOTO MAIN
ENDIF

'we have a VR command!
VRCOMMAND = VRA1
GOSUB led_on
GOSUB standard_pose

'implement actions based on VRGROUP and VRCOMMAND
IF VRGROUP = GROUP_0 THEN
VRGROUP = GROUP_1 ' activate command Group 1
GOSUB talk_phrase2 '"Yes Alan"
GOTO MAIN
ENDIF

IF VRGROUP = GROUP_1 THEN

IF VRCOMMAND = 1 THEN ' Consider MOVE as word 1 of Group 1
VRGROUP = GROUP_2
GOSUB talk_phrase6

ELSEIF VRCOMMAND = 3 THEN ' Consider ROLL as word 3 of Group 1
VRGROUP = GROUP_3
GOSUB talk_phrase6

ELSEIF VRCOMMAND = 4 THEN ' Consider TURN as word 4 of Group 1
VRGROUP = GROUP_4
GOSUB talk_phrase6

ELSEIF VRCOMMAND = 10 THEN ' Consider ATTACK as word 10 of Group 1
VRGROUP = GROUP_5
GOSUB talk_phrase6

ELSE
VRGROUP = GROUP_1 ' back to group 1 commands
ENDIF

ON VRCOMMAND GOTO sleep,MAIN,hands_up,MAIN,MAIN,clap,battery,bow,headstand,wing_move,MAIN
ENDIF

IF VRGROUP = GROUP_2 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_shift,right_shift,forward_move,backward_move
ENDIF

IF VRGROUP = GROUP_3 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_roll,right_roll,forward_roll,back_roll
ENDIF

IF VRGROUP = GROUP_4 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_turn,right_turn
ENDIF

IF VRGROUP = GROUP_5 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_attack,right_attack,forward_punch
ENDIF


GOTO MAIN

'================================================

k3:
GOSUB sit_down_pose
DELAY 1000
GOSUB standard_pose
GOTO MAIN

k17: ' C
GOSUB left_forward
GOSUB standard_pose
GOTO MAIN

k27: ' D
GOSUB right_forward
GOSUB standard_pose
GOTO MAIN



'================================================

battery: ' [ 10 x Value / 256 = Voltage]

GOSUB led_off
V = AD(1)
VOLT = V*100/256
IF VOLT > 65 THEN
GOSUB talk_phrase27
ELSEIF VOLT >= 63 AND VOLT <= 65 THEN
GOSUB talk_phrase28
ELSEIF VOLT >= 60 AND VOLT <= 62 THEN
GOSUB talk_phrase29
ELSEIF VOLT < 60 THEN
GOSUB talk_phrase30
ENDIF
DELAY 1000
GOSUB ready
GOTO MAIN

'================================================

ready:

GOSUB talk_phrase3
DELAY 1000
GOSUB led_on
RETURN

'================================================

led_on:

OUT 52,0
RETURN

'================================================

led_off:

OUT 52,1
RETURN

'================================================

robot_tilt:

A = AD(0)
IF A > 250 THEN RETURN
IF A < 30 THEN GOTO tilt_low
IF A > 180 THEN GOTO tilt_high
RETURN
tilt_low:
A = AD(0)
IF A < 30 THEN
GOTO backward_standup
ENDIF
RETURN
tilt_high:
A = AD(0)
IF A > 180 THEN
GOTO forward_standup
ENDIF
RETURN

'================================================

standard_pose:

MOVE G6A, 100, 76, 145, 93, 100, 100
MOVE G6D, 100, 76, 145, 93, 100, 100
MOVE G6B, 100, 30, 80, 100, 100, 100
MOVE G6C, 100, 30, 80, 100, 100, 100
WAIT
RETURN

'================================================

sleep:

GOSUB led_off
GOSUB talk_phrase5
SPEED 10
MOVE G6A, 100, 151, 23, 140, 101, 100
MOVE G6D, 100, 151, 23, 140, 101, 100
MOVE G6B, 100, 30, 80, 100, 100, 100
MOVE G6C, 100, 30, 80, 100, 100, 100
WAIT
MOTOROFF G24 ' motor power off
TEMPO 230
GOTO MAIN

'================================================

bow:

GOSUB led_off
GOSUB talk_phrase9
DELAY 2000
MOVE G6A, 100, 58, 135, 160, 100, 100
MOVE G6D, 100, 58, 135, 160, 100, 100
MOVE G6B, 100, 30, 80, , , ,
MOVE G6C, 100, 30, 80, , , ,
WAIT
DELAY 1000
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

hands_up:

GOSUB led_off
SPEED 5
GOSUB talk_phrase12
MOVE G6A, 100, 76, 145, 93, 100
MOVE G6D, 100, 76, 145, 93, 100
MOVE G6B, 100, 168, 150
MOVE G6C, 100, 168, 150
WAIT
GOSUB talk_phrase10
DELAY 3000
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

sit_down_pose:

SPEED 10
MOVE G6A, 100, 151, 23, 140, 101, 100
MOVE G6D, 100, 151, 23, 140, 101, 100
MOVE G6B, 100, 30, 80, 100, 100, 100
MOVE G6C, 100, 30, 80, 100, 100, 100
WAIT
RETURN

'================================================

body_move:

SPEED 6
GOSUB body_move1
GOSUB body_move2
GOSUB body_move3
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B, 100, 105, 100, , , ,
MOVE G6C, 100, 105, 100, , , ,
WAIT
MOVE G6A, 104, 112, 92, 116, 107
MOVE G6D, 79, 81, 145, 95, 108
MOVE G6B, 100, 105, 100
MOVE G6C, 100, 105, 100
WAIT
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B, 100, 105, 100, , , ,
MOVE G6C, 100, 105, 100, , , ,
WAIT
MOVE G6D, 104, 112, 92, 116, 107
MOVE G6A, 79, 81, 145, 95, 108
MOVE G6B, 100, 105, 100
MOVE G6C, 100, 105, 100
WAIT
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B, 100, 105, 100, , , ,
MOVE G6C, 100, 105, 100, , , ,
WAIT
GOSUB body_move3
GOSUB body_move2
GOSUB body_move1
RETURN

body_move3:
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT
RETURN

body_move2:
MOVE G6D,110, 92, 124, 97, 93, 70
MOVE G6A, 76, 72, 160, 82, 128, 70
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT
RETURN

body_move1:
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN

'================================================

wing_move:

GOSUB led_off
GOSUB talk_phrase9

DIM i AS BYTE
SPEED 5

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A, 90, 98, 105, 115, 115, 60
MOVE G6D,116, 74, 145, 98, 93, 60
MOVE G6B,100, 150, 150, 100, 100, 100
MOVE G6C,100, 150, 150, 100, 100, 100
WAIT

MOVE G6A, 90, 121, 36, 105, 115, 60
MOVE G6D,116, 60, 146, 138, 93, 60
MOVE G6B,100, 150, 150, 100, 100, 100
MOVE G6C,100, 150, 150, 100, 100, 100
WAIT

MOVE G6A, 90, 98, 105, 64, 115, 60
MOVE G6D,116, 50, 160, 160, 93, 60
MOVE G6B,145, 110, 110, 100, 100, 100
MOVE G6C,145, 110, 110, 100, 100, 100
WAIT

FOR i = 10 TO 15
SPEED i
MOVE G6B,145, 80, 80, 100, 100, 100
MOVE G6C,145, 80, 80, 100, 100, 100
WAIT

MOVE G6B,145, 120, 120, 100, 100, 100
MOVE G6C,145, 120, 120, 100, 100, 100
WAIT
NEXT i

DELAY 1000
SPEED 6

MOVE G6A, 90, 98, 105, 64, 115, 60
MOVE G6D,116, 50, 160, 160, 93, 60
MOVE G6B,100, 160, 180, 100, 100, 100
MOVE G6C,100, 160, 180, 100, 100, 100
WAIT

MOVE G6A, 90, 121, 36, 105, 115, 60
MOVE G6D,116, 60, 146, 138, 93, 60
MOVE G6B,100, 150, 150, 100, 100, 100
MOVE G6C,100, 150, 150, 100, 100, 100
WAIT
SPEED 4

MOVE G6A, 90, 98, 105, 115, 115, 60
MOVE G6D,116, 74, 145, 98, 93, 60
WAIT

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

GOSUB talk_phrase10
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

headstand:

GOSUB led_off
GOSUB talk_phrase9

SPEED 8
GOSUB fall_forward
GOSUB standard_pose
GOSUB foot_up2
GOSUB standard_pose
GOSUB back_stand_up
DELAY 1000
SPEED 6
GOSUB standard_pose
RETURN

fall_forward:

SPEED 10
MOVE G6A, 100, 155, 25, 140, 100, 100
MOVE G6D, 100, 155, 25, 140, 100, 100
MOVE G6B, 130, 50, 85, 100, 100, 100
MOVE G6C, 130, 50, 85, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B, 150, 60, 90, 100, 100, 100
MOVE G6C, 150, 60, 90, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B, 170, 10, 100, 100, 100, 100
MOVE G6C, 170, 10, 100, 100, 100, 100
WAIT
SPEED 3
MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B, 185, 10, 100, 100, 100, 100
MOVE G6C, 185, 10, 100, 100, 100, 100
WAIT
SPEED 10
MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B, 185, 40, 60, 100, 100, 100
MOVE G6C, 185, 40, 60, 100, 100, 100
WAIT
MOVE G6A, 100, 130, 120, 80, 110, 100
MOVE G6D, 100, 130, 120, 80, 110, 100
MOVE G6B, 125, 160, 10, 100, 100, 100
MOVE G6C, 125, 160, 10, 100, 100, 100
WAIT
RETURN

foot_up2:

SPEED 6
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 110, 30, 80, , , ,
MOVE G6C, 110, 30, 80, , , ,
SPEED 3
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 170, 30, 80, , , ,
MOVE G6C, 170, 30, 80, , , ,
WAIT
DELAY 200
SPEED 6
MOVE G6A, 100, 89, 129, 57, 100, ,
MOVE G6D, 100, 89, 129, 57, 100, ,
MOVE G6B, 180, 30, 80, , , ,
MOVE G6C, 180, 30, 80, , , ,
WAIT
MOVE G6A, 100, 64, 179, 57, 100, ,
MOVE G6D, 100, 64, 179, 57, 100, ,
MOVE G6B, 190, 50, 80, , , ,
MOVE G6C, 190, 50, 80, , , ,
WAIT
DELAY 2000
MOVE G6A, 100, 64, 179, 57, 100, ,
MOVE G6D, 100, 64, 179, 57, 100, ,
MOVE G6B, 190, 50, 80, , , ,
MOVE G6C, 190, 50, 80, , , ,
WAIT
MOVE G6A, 100, 89, 129, 57, 100, ,
MOVE G6D, 100, 89, 129, 57, 100, ,
MOVE G6B, 180, 30, 80, , , ,
MOVE G6C, 180, 30, 80, , , ,
WAIT
SPEED 3
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 170, 30, 80, , , ,
MOVE G6C, 170, 30, 80, , , ,
WAIT
SPEED 6
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 110, 30, 80, , , ,
MOVE G6C, 110, 30, 80, , , ,
WAIT
RETURN

back_stand_up:

SPEED 10
MOVE G6A, 100, 130, 120, 80, 110, 100
MOVE G6D, 100, 130, 120, 80, 110, 100
MOVE G6B, 150, 160, 10, 100, 100, 100
MOVE G6C, 150, 160, 10, 100, 100, 100
WAIT
MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B, 185, 40, 60, 100, 100, 100
MOVE G6C, 185, 40, 60, 100, 100, 100
WAIT
MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B, 185, 10, 100, 100, 100, 100
MOVE G6C, 185, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B, 170, 10, 100, 100, 100, 100
MOVE G6C, 170, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B, 150, 60, 90, 100, 100, 100
MOVE G6C, 150, 60, 90, 100, 100, 100
WAIT
MOVE G6A, 100, 155, 25, 140, 100, 100
MOVE G6D, 100, 155, 25, 140, 100, 100
MOVE G6B, 130, 50, 85, 100, 100, 100
MOVE G6C, 130, 50, 85, 100, 100, 100
WAIT

GOSUB talk_phrase10
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

left_turn:

GOSUB led_off
GOSUB talk_phrase12
DIM LT AS BYTE
SPEED 6

FOR LT = 1 TO 6
SPEED 6 'don't lean too fast
'feet together, lean left, stand on left,CGmid-foot
MOVE G6A, 112, 76, 145, 93, 92, 60
MOVE G6D, 85, 71, 152, 91, 112, 60
'arms downish, need hands to clear hips
MOVE G6B, 100, 40, 80, , , ,
WAIT

'right foot fwd, left foot back,
'arms swung opposite (slightly), and slightly out

SPEED 7
MOVE G6A, 113, 75, 145, 97, 93, 60
MOVE G6D, 90, 50, 157, 115, 112, 60
MOVE G6B, 105, 40, 70
MOVE G6C, 90, 40, 70
WAIT
' RETURN
'lean less left so right foot is just touching floor
'right foot fwd, left foot back,
'arms swung opposite (more)

MOVE G6A, 108, 78, 145, 98, 93, 60
MOVE G6D, 95, 43, 169, 110, 110, 60
MOVE G6B, 105, 40, 70
MOVE G6C, 80, 40, 70
WAIT
GOSUB standard_pose
DELAY 500
NEXT LT

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'------------------------------------------------
'P_arms_100_30_80:
'arms down
' MOVE G6B, 100, 30, 80
' MOVE G6C, 100, 30, 80
' RETURN
'------------------------------------------------
'------------------------------------------------
P_arms_100_40_80:
'arms ready stance
MOVE G6B, 100, 40, 80, , , ,
RETURN
'------------------------------------------------

'================================================

right_turn:

GOSUB led_off
GOSUB talk_phrase12
DIM RT AS BYTE
SPEED 6

FOR RT = 1 TO 6

SPEED 6 'don't lean too fast
'feet together, lean right, stand on right,CGmid-foot
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D, 112, 76, 145, 93, 92, 60
'arms downish, need hands to clear hips
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 7
'left foot fwd, right foot back
'arms swung opposite (slightly), and slightly out
MOVE G6A, 90, 50, 157, 115, 112, 60
MOVE G6D, 113, 75, 145, 97, 93, 60
MOVE G6B, 90, 40, 70, , , ,
MOVE G6C, 105, 40, 70, , , ,
WAIT

'lean less right so left foot is just touching floor
'left foot fwd, right foot back,
'arms swung opposite (more)
MOVE G6D, 108, 78, 145, 98, 93, 60
MOVE G6A, 95, 43, 169, 110, 110, 60
MOVE G6C, 105, 40, 70
MOVE G6B, 80, 40, 70
WAIT

GOSUB standard_pose
DELAY 500
NEXT RT

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'-----------------------------------

' MOVE G6A, 85, 71, 152, 91, 112, 60
' MOVE G6D, 112, 76, 145, 93, 92, 60
' MOVE G6B, 100, 40, 80, , , ,
' MOVE G6C, 100, 40, 80, , , ,
' WAIT
' MOVE G6D, 113, 75, 145, 97, 93, 60
' MOVE G6A, 90, 50, 157, 115, 112, 60
' MOVE G6C, 105, 40, 70, , , ,
' MOVE G6B, 90, 40, 70, , , ,
' WAIT
' MOVE G6D, 108, 78, 145, 98, 93, 60
' MOVE G6A, 95, 43, 169, 110, 110, 60
' MOVE G6C, 105, 40, 70, , , ,
' MOVE G6B, 80, 40, 70, , , ,
' WAIT
' NEXT RT

' GOSUB standard_pose
' DELAY 500
' GOSUB ready
' GOTO MAIN

'================================================

forward_move:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5

MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 114, 76, 145, 93, 90, 60,
'---------------------------------------
'left down
MOVE24 90, 56, 143, 122, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 113, 80, 145, 90, 90, 60,
MOVE24 90, 46, 163, 112, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 112, 80, 145, 90, 90, 60,

SPEED 10
'left center
MOVE24 100, 66, 141, 113, 100, 100, 90, 40, 80, , , , 100, 40, 80, , , , 100, 83, 156, 80, 100, 100,
MOVE24 113, 78, 142, 105, 90, 60, 100, 40, 80, , , , 100, 40, 80, , , , 90, 102, 136, 85, 114, 60,

SPEED 14
'right up
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,

'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
MOVE24 112, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 46, 163, 112, 114, 60,

SPEED 10
'right center
MOVE24 100, 83, 156, 80, 100, 100, 100, 40, 80, , , , 90, 40, 80, , , , 100, 66, 141, 113, 100, 100,
MOVE24 90, 102, 136, 85, 114, 60, 100, 40, 80, , , , 100, 40, 80, , , , 113, 78, 142, 105, 90, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 113, 76, 145, 93, 90, 60,
'---------------------------------------

SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

walk:

WALK = 1
SPEED 5
GOSUB talk_phrase12
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 114, 76, 145, 93, 90, 60,
'---------------------------------------
'left down
MOVE24 90, 56, 143, 122, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 113, 80, 145, 90, 90, 60,
MOVE24 90, 46, 163, 112, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 112, 80, 145, 90, 90, 60,

SPEED 10
'left center
MOVE24 100, 66, 141, 113, 100, 100, 90, 40, 80, , , , 100, 40, 80, , , , 100, 83, 156, 80, 100, 100,
MOVE24 113, 78, 142, 105, 90, 60, 100, 40, 80, , , , 100, 40, 80, , , , 90, 102, 136, 85, 114, 60,

SPEED 14
'right up
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,

'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
MOVE24 112, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 46, 163, 112, 114, 60,

SPEED 10
'right center
MOVE24 100, 83, 156, 80, 100, 100, 100, 40, 80, , , , 90, 40, 80, , , , 100, 66, 141, 113, 100, 100,
MOVE24 90, 102, 136, 85, 114, 60, 100, 40, 80, , , , 100, 40, 80, , , , 113, 78, 142, 105, 90, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 113, 76, 145, 93, 90, 60,
'---------------------------------------

SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

GOSUB standard_pose

GOTO MAIN

'================================================

left_shift:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5

GOSUB talk_phrase12
MOVE G6A, 85, 71, 152, 91, 112, 60,
MOVE G6D, 112, 76, 145, 93, 92, 60,
MOVE G6B, 100, 40, 80, , , ,
MOVE G6C, 100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6D, 110, 92, 124, 97, 93, 70,
MOVE G6A, 76, 72, 160, 82, 128, 70,
MOVE G6B, 100, 35, 90, , , ,
MOVE G6C, 100, 35, 90, , , ,
WAIT

MOVE G6A, 93, 76, 145, 94, 109, 100,
MOVE G6D, 93, 76, 145, 94, 109, 100,
MOVE G6B, 100, 35, 90, , , ,
MOVE G6C, 100, 35, 90, , , ,
WAIT

MOVE G6A, 110, 92, 124, 97, 93, 70,
MOVE G6D, 76, 72, 160, 82, 128, 70,
MOVE G6B, 100, 35, 90, , , ,
MOVE G6C, 100, 35, 90, , , ,
WAIT

SPEED 7
MOVE G6D, 86, 83, 135, 97, 114, 60,
MOVE G6A, 113, 78, 145, 93, 93, 60,
MOVE G6C, 90, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

MOVE G6D, 85, 71, 152, 91, 112, 60,
MOVE G6A, 112, 76, 145, 93, 92, 60,
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 6
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

sit_down_pose26:

IF A26 = 0 THEN GOTO standard_pose26

A26 = 0
SPEED 10
MOVE G6A,100, 151, 23, 140, 101, 100
MOVE G6D,100, 151, 23, 140, 101, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT

RETURN

standard_pose26:
A26 = 1
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT

RETURN

'================================================

right_shift:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5
MOVE G6D, 85, 71, 152, 91, 112, 60
MOVE G6A, 112, 76, 145, 93, 92, 60
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6A,110, 92, 124, 97, 93, 70
MOVE G6D, 76, 72, 160, 82, 128, 70
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT

MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT

MOVE G6D,110, 92, 124, 97, 93, 70
MOVE G6A, 76, 72, 160, 82, 128, 70
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT

SPEED 7
MOVE G6A, 86, 83, 135, 97, 114, 60
MOVE G6D,113, 78, 145, 93, 93, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 6
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

backward_move:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 13
MOVE G6A, 90, 107, 105, 105, 114, 60
MOVE G6D,113, 78, 145, 93, 90, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6D,113, 76, 142, 105, 90, 60
MOVE G6A, 90, 96, 136, 85, 114, 60
MOVE G6C,100, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT

MOVE G6D,100, 62, 146, 108, 100, 100
MOVE G6A,100, 88, 140, 86, 100, 100
MOVE G6C,90, 40, 80, , ,,
MOVE G6B,100, 40, 80, , , ,
WAIT

MOVE G6D, 90, 56, 143, 122, 114, 60
MOVE G6A,113, 80, 145, 90, 90, 60
MOVE G6C,80, 40, 80, , , ,
MOVE G6B,105, 40, 80, , , ,
WAIT

SPEED 13
MOVE G6D, 90, 107, 105, 105, 114, 60
MOVE G6A,113, 78, 145, 93, 90, 60
MOVE G6C,90, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6A,113, 76, 142, 105, 90, 60
MOVE G6D, 90, 96, 136, 85, 114, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A,100, 62, 146, 108, 100, 100
MOVE G6D,100, 88, 140, 86, 100, 100
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A, 90, 56, 143, 122, 114, 60
MOVE G6D,113, 80, 145, 90, 90, 60
MOVE G6B, 80, 40, 80, , , ,
MOVE G6C,105, 40, 80, , , ,
WAIT

SPEED 13
MOVE G6A, 90, 107, 105, 105, 114, 60
MOVE G6D,113, 78, 145, 93, 90, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 5
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

forward_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
GOSUB standard_pose
MOVE G6A,100, 155, 20, 140, 100, 100
MOVE G6D,100, 155, 20, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT

MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,130, 160, 10, 100, 100, 100
MOVE G6C,130, 160, 10, 100, 100, 100
WAIT

MOVE G6A,100, 160, 110, 140, 100, 100
MOVE G6D,100, 160, 110, 140, 100, 100
MOVE G6B,140, 70, 20, 100, 100, 100
MOVE G6C,140, 70, 20, 100, 100, 100
WAIT

SPEED 15
MOVE G6A,100, 56, 110, 26, 100, 100
MOVE G6D,100, 71, 177, 162, 100, 100
MOVE G6B,170, 40, 50, 100, 100, 100
MOVE G6C,170, 40, 50, 100, 100, 100
WAIT

MOVE G6A,100, 62, 110, 15, 100, 100
MOVE G6D,100, 71, 128, 113, 100, 100
MOVE G6B,190, 40, 50, 100, 100, 100
MOVE G6C,190, 40, 50, 100, 100, 100
WAIT

SPEED 15
MOVE G6A,100, 55, 110, 15, 100, 100
MOVE G6D,100, 55, 110, 15, 100, 100
MOVE G6B,190, 40, 50, 100, 100, 100
MOVE G6C,190, 40, 50, 100, 100, 100
WAIT

SPEED 10

MOVE G6A,100, 110, 100, 15, 100, 100
MOVE G6D,100, 110, 100, 15, 100, 100
MOVE G6B,170, 160, 115, 100, 100, 100
MOVE G6C,170, 160, 115, 100, 100, 100
WAIT

MOVE G6A,100, 170, 70, 15, 100, 100
MOVE G6D,100, 170, 70, 15, 100, 100
MOVE G6B,190, 170, 120, 100, 100, 100
MOVE G6C,190, 170, 120, 100, 100, 100
WAIT

MOVE G6A,100, 170, 30, 110, 100, 100
MOVE G6D,100, 170, 30, 110, 100, 100
MOVE G6B,190, 40, 60, 100, 100, 100
MOVE G6C,190, 40, 60, 100, 100, 100
WAIT

GOSUB sit_pose
GOSUB standard_pose
DELAY 500
GOSUB ready
RETURN

'================================================

sit_pose:

SPEED 10
MOVE G6A,100, 151, 23, 140, 101, 100,
MOVE G6D,100, 151, 23, 140, 101, 100,
MOVE G6B,100, 30, 80, 100, 100, 100,
MOVE G6C,100, 30, 80, 100, 100, 100,
WAIT
RETURN

'================================================

left_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

DELAY 100
SPEED 3
MOVE G6A,114, 135, 60, 123, 105, 100
MOVE G6D, 88, 110, 91, 116, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT
DELAY 100
MOVE G6A,114, 135, 60, 123, 105, 100
MOVE G6D,89, 135, 60, 123, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

MOVE G6A,120, 135, 60, 123, 110, 100
MOVE G6D, 89, 135, 60, 123, 130, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,120, 135, 60, 123, 120, 100
MOVE G6D,89, 135, 60, 123, 158, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

SPEED 8
MOVE G6A,120, 131, 60, 123, 185, 100
MOVE G6D,120, 131, 60, 123, 183, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

DELAY 200

SPEED 5
MOVE G6A,120, 131, 60, 123, 185, 100
MOVE G6D,120, 131, 60, 123, 183, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 6
MOVE G6A, 86, 112, 73, 127, 101, 100
MOVE G6D,105, 131, 60, 123, 183, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 3
MOVE G6A, 86, 118, 73, 127, 101, 100
MOVE G6D,112, 131, 62, 123, 133, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 3
MOVE G6A, 88, 115, 86, 115, 90, 100
MOVE G6D,107, 135, 62, 123, 113, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================

forward_punch:

GOSUB led_off
GOSUB talk_phrase12

SPEED 15
MOVE G6A, 92, 100, 110, 100, 107, 100
MOVE G6D, 92, 100, 110, 100, 107, 100
MOVE G6B,190, 150, 10, 100, 100, 100
MOVE G6C,190, 150, 10, 100, 100, 100
WAIT
SPEED 15
HIGHSPEED SETON

MOVE G6B,190, 10, 75, 100, 100, 100
MOVE G6C,190, 140, 10, 100, 100, 100
WAIT
DELAY 500
MOVE G6B,190, 140, 10, 100, 100, 100
MOVE G6C,190, 10, 75, 100, 100, 100
WAIT
DELAY 500

MOVE G6A, 92, 100, 113, 100, 107, 100
MOVE G6D, 92, 100, 113, 100, 107, 100
MOVE G6B,190, 150, 10, 100, 100, 100
MOVE G6C,190, 150, 10, 100, 100, 100
WAIT

HIGHSPEED SETOFF
MOVE G6A,100, 115, 90, 110, 100, 100
MOVE G6D,100, 115, 90, 110, 100, 100
MOVE G6B,100, 80, 60, 100, 100, 100
MOVE G6C,100, 80, 60, 100, 100, 100
WAIT

GOSUB talk_phrase3
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

right_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT
DELAY 100

SPEED 3
MOVE G6A, 83, 110, 91, 116, 100, 100
MOVE G6D,114, 135, 60, 123, 105, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT
DELAY 100

MOVE G6A,89, 135, 60, 123, 100, 100
MOVE G6D,114, 135, 60, 123, 105, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

MOVE G6A, 89, 135, 60, 123, 130, 100
MOVE G6D,120, 135, 60, 123, 110, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,89, 135, 60, 123, 158, 100
MOVE G6D,120, 135, 60, 123, 120, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

SPEED 8
MOVE G6A,120, 131, 60, 123, 183, 100
MOVE G6D,120, 131, 60, 123, 185, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

DELAY 200

SPEED 5
MOVE G6A,120, 131, 60, 123, 183, 100
MOVE G6D,120, 131, 60, 123, 185, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 6
MOVE G6A,105, 131, 60, 123, 183, 100
MOVE G6D, 86, 112, 73, 127, 101, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 3
MOVE G6A,112, 131, 62, 123, 133, 100
MOVE G6D, 86, 118, 73, 127, 101, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 3
MOVE G6A,107, 135, 62, 123, 113, 100
MOVE G6D, 88, 115, 89, 115, 90, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================

back_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
MOVE G6A, 100, 170, 71, 23, 100, 100
MOVE G6D, 100, 170, 71, 23, 100, 100
MOVE G6B, 80, 50, 70, 100, 100, 100
MOVE G6C, 80, 50, 70, 100, 100, 100
WAIT

MOVE G6A, 100, 133, 71, 23, 100, 100
MOVE G6D, 100, 133, 71, 23, 100, 100
MOVE G6B, 10, 96, 15, 100, 100, 100
MOVE G6C, 10, 96, 14, 100, 100, 100
WAIT

MOVE G6A, 100, 133, 49, 23, 100, 100
MOVE G6D, 100, 133, 49, 23, 100, 100
MOVE G6B, 45, 116, 15, 100, 100, 100
MOVE G6C, 45, 116, 14, 100, 100, 100
WAIT

MOVE G6A, 100, 133, 49, 23, 100, 100
MOVE G6D, 100, 70, 180, 160, 100, 100
MOVE G6B, 45, 50, 70, 100, 100, 100
MOVE G6C, 45, 50, 70, 100, 100, 100
WAIT

SPEED 15
MOVE G6A, 100, 133, 180, 160, 100, 100
MOVE G6D, 100, 133, 180, 160, 100, 100
MOVE G6B, 10, 50, 70, 100, 100, 100
MOVE G6C, 10, 50, 70, 100, 100, 100
WAIT

HIGHSPEED SETON
MOVE G6A, 100, 95, 180, 160, 100, 100
MOVE G6D, 100, 95, 180, 160, 100, 100
MOVE G6B, 160, 50, 70, 100, 100, 100
MOVE G6C, 160, 50, 70, 100, 100, 100
WAIT

HIGHSPEED SETOFF

MOVE G6A, 100, 130, 120, 80, 110, 100
MOVE G6D, 100, 130, 120, 80, 110, 100
MOVE G6B, 130, 160, 10, 100, 100, 100
MOVE G6C, 130, 160, 10, 100, 100, 100
WAIT

GOSUB back_standing
GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================

back_standing:

SPEED 10
MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,150, 160, 10, 100, 100, 100
MOVE G6C,150, 160, 10, 100, 100, 100
WAIT

MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT

MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B,150, 60, 90, 100, 100, 100
MOVE G6C,150, 60, 90, 100, 100, 100
WAIT

MOVE G6A,100, 155, 25, 140, 100, 100
MOVE G6D,100, 155, 25, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT

RETURN

'================================================

left_attack:

GOSUB led_off
GOSUB talk_phrase12

SPEED 7
MOVE G6A, 85, 71, 152, 91, 107, 60
MOVE G6D, 108, 76, 145, 93, 100, 60
MOVE G6B, 100, 40, 80, , , ,
MOVE G6C, 100, 40, 80, , , ,
WAIT

SPEED 12
HIGHSPEED SETON
MOVE G6A, 98, 157, 20, 134, 110, 100
MOVE G6D, 57, 115, 77, 125, 134, 100
MOVE G6B,107, 135, 108, 100, 100, 100
MOVE G6C,112, 92, 99, 100, 100, 100
WAIT
DELAY 1000
HIGHSPEED SETOFF
SPEED 15
GOSUB sit_pose

GOSUB talk_phrase3
GOSUB standard_pose
GOSUB ready
GOTO MAIN



'================================================

right_attack:

GOSUB led_off
GOSUB talk_phrase12

SPEED 7
MOVE G6D, 85, 71, 152, 91, 107, 60
MOVE G6A, 108, 76, 145, 93, 100, 60
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 12
HIGHSPEED SETON
MOVE G6D, 98, 157, 20, 134, 110, 100
MOVE G6A, 57, 115, 77, 125, 134, 100
MOVE G6B,112, 92, 99, 100, 100, 100
MOVE G6C,107, 135, 108, 100, 100, 100
WAIT
DELAY 1000
HIGHSPEED SETOFF
SPEED 15
GOSUB sit_pose

GOSUB talk_phrase3
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

left_forward:

SPEED 7

MOVE G6A, 85, 71, 152, 91, 107, 60
MOVE G6D, 108, 76, 145, 93, 100, 60
MOVE G6B, 130, 40, 80, , , ,
MOVE G6C, 70, 40, 80, , , ,
WAIT

SPEED 12
HIGHSPEED SETON

MOVE G6A, 107, 164, 21, 125, 93
MOVE G6D, 66, 163, 85, 65, 130
MOVE G6B, 189, 40, 77
MOVE G6C, 50, 72, 86
WAIT

DELAY 1000
HIGHSPEED SETOFF

GOSUB sit_pose
RETURN


'================================================

right_forward:

SPEED 7
MOVE G6D, 85, 71, 152, 91, 107, 60
MOVE G6A, 108, 76, 145, 93, 100, 60
MOVE G6C, 130, 40, 80, , , ,
MOVE G6B, 70, 40, 80, , , ,
WAIT

SPEED 10
HIGHSPEED SETON
MOVE G6D, 107, 164, 21, 125, 93
MOVE G6A, 66, 163, 85, 65, 130
MOVE G6C, 189, 40, 77
MOVE G6B, 50, 72, 86
WAIT

DELAY 1000
HIGHSPEED SETOFF

GOSUB sit_pose
RETURN

'================================================

forward_standup:

SPEED 10

MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,150, 160, 10, 100, 100, 100
MOVE G6C,150, 160, 10, 100, 100, 100
WAIT

MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT

MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B,150, 60, 90, 100, 100, 100
MOVE G6C,150, 60, 90, 100, 100, 100
WAIT

MOVE G6A,100, 155, 25, 140, 100, 100
MOVE G6D,100, 155, 25, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT

GOSUB standard_pose
RETURN

'================================================

backward_standup:

SPEED 10

MOVE G6A,100, 10, 100, 115, 100, 100
MOVE G6D,100, 10, 100, 115, 100, 100
MOVE G6B,100, 130, 10, 100, 100, 100
MOVE G6C,100, 130, 10, 100, 100, 100
WAIT

MOVE G6A,100, 10, 83, 140, 100, 100
MOVE G6D,100, 10, 83, 140, 100, 100
MOVE G6B, 20, 130, 10, 100, 100, 100
MOVE G6C, 20, 130, 10, 100, 100, 100
WAIT

MOVE G6A,100, 126, 60, 50, 100, 100
MOVE G6D,100, 126, 60, 50, 100, 100
MOVE G6B, 20, 30, 90, 100, 100, 100
MOVE G6C, 20, 30, 90, 100, 100, 100
WAIT

MOVE G6A,100, 165, 70, 15, 100, 100
MOVE G6D,100, 165, 70, 15, 100, 100
MOVE G6B, 30, 20, 95, 100, 100, 100
MOVE G6C, 30, 20, 95, 100, 100, 100
WAIT

MOVE G6A,100, 165, 40, 100, 100, 100
MOVE G6D,100, 165, 40, 100, 100, 100
MOVE G6B,110, 70, 50, 100, 100, 100
MOVE G6C,110, 70, 50, 100, 100, 100
WAIT

GOSUB standard_pose
RETURN
'=================================================

clap:

GOSUB led_off
GOSUB talk_phrase12
DIM hci AS BYTE 'loop counter
SPEED 10
WAIT

HIGHSPEED SETON

MOVE G6C, 145, 20, 70, , , ,
MOVE G6B, 145, 20, 70, , , ,

FOR hci = 0 TO 1
MOVE G6C, 145, 20, 40, , , ,
MOVE G6B, 145, 20, 40, , , ,
WAIT

MOVE G6C, 145, 15, 25, , , ,
MOVE G6B, 145, 15, 25, , , ,
WAIT

MOVE G6C, 145, 20, 40, , , ,
MOVE G6B, 145, 20, 40, , , ,
WAIT
DELAY 100

MOVE G6C, 145, 15, 25, , , ,
MOVE G6B, 145, 15, 25, , , ,
WAIT

MOVE G6C, 155, 20, 40, , , ,
MOVE G6B, 155, 20, 40, , , ,
WAIT
DELAY 100

MOVE G6C, 155, 15, 25, , , ,
MOVE G6B, 155, 15, 25, , , ,
WAIT

MOVE G6C, 155, 20, 40, , , ,
MOVE G6B, 155, 20, 40, , , ,
WAIT

DELAY 400
NEXT hci

MOVE G6C, 145, 20, 70, , , ,
MOVE G6B, 145, 20, 70, , , ,

HIGHSPEED SETOFF
GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================
'SP03 SPEECH
'================================================

talk_phrase1: 'MY POWER IS ON
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H01 'Speak phrase 1
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase2: 'YES ALAN
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H02 'Speak phrase 2
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase3: 'OK, WHAT NEXT
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H03 'Speak phrase 3
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase4: 'SORRY PLEASE REPEAT THAT
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H04 'Speak phrase 4
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase5: 'GOODBYE ALAN
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H05 'Speak phrase 5
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase6: 'WHICH WAY
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H06 'Speak phrase 6
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase7: 'READY
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H07 'Speak phrase 7
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase8:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H08 'Speak phrase 8
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase9: 'HELLO ALAN
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H09 'Speak phrase 9
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase10: 'MY HANDS ARE NOW UP
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0A 'Speak phrase 10
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase11: '
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0B 'Speak phrase 11
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase12: 'OK
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0C 'Speak phrase 12
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase13: '
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0D 'Speak phrase 13
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase14: '
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0E 'Speak phrase 14
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase15:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0F 'Speak phrase 15
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase16:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H10 'Speak phrase 16
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase17:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H11 'Speak phrase 17
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase18:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H12 'Speak phrase 18
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase19:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H13 'Speak phrase 19
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase20:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H14 'Speak phrase 20
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase21:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H15 'Speak phrase 21
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase22:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H16 'Speak phrase 22
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase23:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H17 'Speak phrase 23
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase24:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H18 'Speak phrase 24
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase25:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H19 'Speak phrase 25
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase26:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1A 'Speak phrase 26
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase27: 'MY BATTERY IS FULLY CHARGED
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1B 'Speak phrase 27
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase28: 'MY BATTERY LEVEL IS GOOD
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1C 'Speak phrase 28
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase29: 'MY BATTERY IS GETTING LOW
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1D 'Speak phrase 29
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase30: 'MY BATTERY LEVEL IS VERY LOW. PLEASE RECHARGE ME
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1E 'Speak phrase 30
GOSUB I2cByteWrite
RETURN

'================================================

FillSpeechBuffer_ready:
GOSUB I2cStart 'Start sequence
I2cBuf = I2cAddr
GOSUB I2cOutByte 'Send SP03 address
I2cBuf = 0
GOSUB I2cOutByte 'Select Command Register
GOSUB I2cOutByte 'Send NOP
GOSUB I2cOutByte 'Max volume = Zero??
I2cBuf = &H05
GOSUB I2cOutByte 'Speech Speed
I2cBuf = &H03
GOSUB I2cOutByte 'Speech Pitch
'** Followed by the ASCII characters (85 maximum) of the words you would like RN to say
I2cBuf = &H52 'R
GOSUB I2cOutByte
I2cBuf = &H65 'e
GOSUB I2cOutByte
I2cBuf = &H61 'a
GOSUB I2cOutByte
I2cBuf = &H64 'd
GOSUB I2cOutByte
I2cBuf = &H79 'y
GOSUB I2cOutByte
I2cBuf = 0 'Nul
GOSUB I2cOutByte
GOSUB I2cStop
DELAY 2
RETURN

'================================================

FillSpeechBuffer_hello:
GOSUB I2cStart 'Start sequence
I2cBuf = I2cAddr
GOSUB I2cOutByte 'Send SP03 address
I2cBuf = 0
GOSUB I2cOutByte 'Select Command Register
GOSUB I2cOutByte 'Send NOP
GOSUB I2cOutByte 'Max volume = Zero??
I2cBuf = &H05
GOSUB I2cOutByte 'Speech Speed
I2cBuf = &H03
GOSUB I2cOutByte 'Speech Pitch
'** Followed by the ASCII characters (85 maximum) of the words you would like RN to say for example, Hello
I2cBuf = &H48 'H
GOSUB I2cOutByte
I2cBuf = &H65 'e
GOSUB I2cOutByte
I2cBuf = &H6C 'l
GOSUB I2cOutByte
I2cBuf = &H6C 'l
GOSUB I2cOutByte
I2cBuf = &H06F 'o
GOSUB I2cOutByte
I2cBuf = 0 'Nul
GOSUB I2cOutByte
GOSUB I2cStop
DELAY 2
RETURN

'================================================

I2cByteWrite:
GOSUB I2cStart
I2cBuf = I2cAddr
GOSUB I2cOutByte
I2cBuf = I2cReg
GOSUB I2cOutByte
I2cBuf = I2cData
GOSUB I2cOutByte
GOSUB I2cStop
RETURN

'================================================

I2cByteRead:
GOSUB I2cStart
I2cBuf = I2cAddr
GOSUB I2cOutByte
I2cBuf = I2cReg
GOSUB I2cOutByte
GOSUB I2cStart 'the required repeated start bit
I2cBuf = I2cAddr OR 1
GOSUB I2cOutByte
GOSUB I2cInByte
I2cData = I2cBuf
GOSUB I2cStop
RETURN

'================================================

I2cOutByte:
FOR I2cBit = 0 TO 7
I2cTx = I2cBuf AND &H80
IF I2cTx <> 0 THEN
OUT SDA,1
ELSE
OUT SDA,0
ENDIF
'DELAY 1
OUT SCL, 1
'DELAY 1
OUT SCL, 0
'DELAY 1
I2cBuf = I2cBuf << 1
NEXT I2cBit
OUT SDA, 0
'DELAY 1
OUT SCL, 1
'DELAY 1
OUT SCL, 0
RETURN

'================================================

I2cInByte:
I2cBuf =0
OUT SDA, 1
I2cRx = IN(SDA)
FOR I2cBit = 0 TO 7
OUT SCL, 1
'DELAY 1
I2cRx = IN(SDA)
OUT SCL, 0
'DELAY 1
I2cBuf = I2cBuf << 1
IF I2cRx <> 0 THEN
I2cBuf = I2cBuf +1
ENDIF
'DELAY 1
NEXT I2cBit
OUT SDA, 0
'DELAY 1
OUT SCL, 1
'DELAY 1
OUT SCL, 0
'DELAY 1
RETURN

'================================================

I2cStart:
OUT SDA,1
'DELAY 1
OUT SCL,1
'DELAY 1
OUT SDA,0
'DELAY 1
OUT SCL,0
'DELAY 1
RETURN

'================================================

I2cStop:
OUT SCL,1
'DELAY 1
OUT SDA,1
RETURN

'================================================
'================================================
Hi,

Got your message via Youtube but no idea how to reply that way. Below is the final code I used for the combined VRbot and SP03 - hope it's useful for you. Sorry I can't comment on the code you sent me as I did this years ago and it's all just a dim distant memory. I do recall I had to do quite a bit of tweaking to get it to work.

Cheers,

Alan

'================================================
'
' Language recognition with a VRbot and speech with an SP03 to perform basic commands
'
'================================================

' VRbot definitions and routines

GOSUB led_off

CONST RES_ERROR = 255
CONST RES_TIMEOUT = 254
CONST RES_WAITING = 253
CONST RES_BUILTIN = 32

CONST SDA = 46 'Use port 46 for Data, constant SDA
CONST SCL = 47 'Use port 47 for Clock, constant SCL

DIM I2cBuf AS BYTE
DIM I2cAddr AS BYTE
DIM I2cReg AS BYTE
DIM I2cData AS BYTE
DIM I2cBit AS BYTE
DIM I2cTx AS BYTE
DIM I2cRx AS BYTE

' VRA = protocol command/status byte
' VRA1 = first in/out argument
DIM VRA AS BYTE, VRA1 AS BYTE

' VRLED = led status
'DIM VRLED AS BYTE
'VRLED = 1 'off

' main program begins at Startup label
GOTO Startup

CONST CMD_BREAK = &H62 ' abort recog or ping
CONST CMD_SLEEP = &H73 ' go to power down
CONST CMD_KNOB = &H6B ' set si knob <1>
CONST CMD_LEVEL = &H76 ' set sd level <1>
CONST CMD_LANGUAGE = &H6C ' set language <1>
CONST CMD_TIMEOUT = &H6F ' set timeout <1>
CONST CMD_RECOG_SI = &H69 ' do si recog from ws <1>
CONST CMD_RECOG_SD = &H64 ' do sd recog at group <1> (0 = trigger mixed si/sd)

CONST STS_AWAKEN = &H77 ' back from power down mode
CONST STS_ERROR = &H65 ' signal error code <1-2>
CONST STS_INVALID = &H76 ' invalid command or argument
CONST STS_TIMEOUT = &H74 ' timeout expired
CONST STS_INTERR = &H69 ' back from aborted recognition (see 'break')
CONST STS_SUCCESS = &H6F ' no errors status
CONST STS_RESULT = &H72 ' recognised sd command <1> - training similar to sd <1>
CONST STS_SIMILAR = &H73 ' recognised si <1> (in mixed si/sd) - training similar to si <1>

CONST ARG_ACK = &H20

' protocol arguments are IN the range 0x40 (-1) TO 0x60 (+31) inclusive
CONST ARG_MIN = &H40
CONST ARG_MAX = &H60
CONST ARG_ZERO = &H41
CONST ARG_ONE = &H42

' ===== VR routines

' Inputs:
' NONE
VR_Wakeup:
VRA = CMD_BREAK
ETX 9600, VRA
VR_Wakeup1:
ERX 9600, VRA, VR_Wakeup1
IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = timeout (in seconds, 0=forever, 255=default)
VR_SetTimeout:
VRA = CMD_TIMEOUT
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetTimeout1:
ERX 9600, VRA, VR_SetTimeout1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = language index (0 = english, ...)
VR_SetLanguage:
VRA = CMD_LANGUAGE
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetLanguage1:
ERX 9600, VRA, VR_SetLanguage1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = sd strictness level (1=easy ... 5=hard)
VR_SetLevel:
VRA = CMD_LEVEL
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetLevel1:
ERX 9600, VRA, VR_SetLevel1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = si confidence knob (2=typical, 0=loosest ... 4=tightest)
VR_SetKnob:
VRA = CMD_KNOB
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_SetKnob1:
ERX 9600, VRA, VR_SetKnob1
'IF VRA <> STS_SUCCESS THEN GOTO VR_Wakeup
RETURN

' Inputs:
' VRA1 = wordset (0=trigger)
' Ouputs:
' VRA1 = result (0-31=word, 32..=builtin, 254=timeout, 255=error)
' for trigger N>1 are custom words
VR_RecognizeSI:
VRA = CMD_RECOG_SI
GOTO VR_Recognize0
VR_RecognizeSD:
VRA = CMD_RECOG_SD
VR_Recognize0:
ETX 9600, VRA
VRA1 = VRA1 + ARG_ZERO
ETX 9600, VRA1
VR_Recognize1:
VRA1 = RES_WAITING
RETURN
VR_CheckRecognition:
ERX 9600, VRA, VR_Recognize1
IF VRA = STS_RESULT THEN
VRA = ARG_ACK
ETX 9600, VRA
VR_Recognize2:
ERX 9600, VRA1, VR_Recognize2
VRA1 = VRA1 - ARG_ZERO
ELSEIF VRA = STS_SIMILAR THEN
VRA = ARG_ACK
ETX 9600, VRA
VR_Recognize3:
ERX 9600, VRA1, VR_Recognize3
VRA1 = VRA1 - ARG_ZERO + RES_BUILTIN
ELSEIF VRA = STS_TIMEOUT THEN
VRA1 = RES_TIMEOUT
ELSE
VRA1 = RES_ERROR
ENDIF
RETURN

'================================================
' Main Program

Startup:

' A : temporary variable
' A16,A26 : temporary variable
DIM A AS BYTE
DIM A16 AS BYTE
DIM A26 AS BYTE
DIM V AS BYTE
DIM VOLT AS BYTE
DIM VOLT1 AS BYTE
DIM VOLT2 AS BYTE
DIM WALK AS BYTE

PTP SETON
PTP ALLON

'== motor direction setting ======================
DIR G6A,1,0,0,1,0,0
DIR G6B,1,1,1,1,1,1
DIR G6C,0,0,0,0,0,0
DIR G6D,0,1,1,0,1,0

'== motor start position read ===================
TEMPO 230
'MUSIC "CDE"
GETMOTORSET G24,1,1,1,1,1,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,1,1,0
'== motor power on =============================
SPEED 5
MOTOR G24
'GOSUB standard_pose
'GOSUB battery

'================================================
DIM VRGROUP AS BYTE
DIM VRCOMMAND AS BYTE

'Groups and Commands

CONST GROUP_0 = 0 '(Command count: 1)

CONST G0_ROBO = 0

CONST GROUP_1 = 1 '(Command count: 11)

CONST G1_STOP = 0
CONST G1_MOVE = 1
CONST G1_HANDS_UP = 2
CONST G1_ROLL = 3
CONST G1_TURN = 4
CONST G1_CLAP = 5
CONST G1_BATTERY = 6
CONST G1_HELLO = 7
CONST G1_HEADSTAND = 8
CONST G1_FLY = 9
CONST G1_ATTACK = 10

CONST GROUP_2 = 2 '(Command count: 4)

CONST G2_LEFT = 0
CONST G2_RIGHT = 1
CONST G2_FORWARD = 2
CONST G2_BACK = 3

CONST GROUP_3 = 3 '(Command count: 4)

CONST G3_LEFT = 0
CONST G3_RIGHT = 1
CONST G3_FORWARD = 2
CONST G3_BACK = 3

CONST GROUP_4 = 4 '(Command count: 3)

CONST G4_LEFT = 0
CONST G4_RIGHT = 1
CONST G4_AROUND = 2

CONST GROUP_5 = 5 '(Command count: 3)

CONST G5_LEFT = 0
CONST G5_RIGHT = 1
CONST G5_FRONT = 2




'start with trigger command group
VRGROUP = 0

'sync with VRbot
GOSUB VR_Wakeup

'Set SI Language
VRA1 = 0
GOSUB VR_SetLanguage

MAIN:
'GOSUB robot_tilt

'start Voice Recognition in current group
VRA1 = VRGROUP
GOSUB VR_RecognizeSD

MAIN1:
'listen for VR commands
GOSUB VR_CheckRecognition
'nothing heard?
IF VRA1 = RES_WAITING THEN
DELAY 400
GOTO MAIN1
ENDIF

'unexpected reply?
IF VRA1 = RES_ERROR THEN
' GOSUB talk_phrase4
GOTO MAIN 'try again in the same group
ENDIF

'timed out?
IF VRA1 = RES_TIMEOUT THEN
' GOSUB talk_phrase5
VRGROUP = 0 ' back to trigger
GOSUB led_off
GOTO MAIN
ENDIF

'we have a VR command!
VRCOMMAND = VRA1
GOSUB led_on
GOSUB standard_pose

'implement actions based on VRGROUP and VRCOMMAND
IF VRGROUP = GROUP_0 THEN
VRGROUP = GROUP_1 ' activate command Group 1
GOSUB talk_phrase2 '"Yes Alan"
GOTO MAIN
ENDIF

IF VRGROUP = GROUP_1 THEN

IF VRCOMMAND = 1 THEN ' Consider MOVE as word 1 of Group 1
VRGROUP = GROUP_2
GOSUB talk_phrase6

ELSEIF VRCOMMAND = 3 THEN ' Consider ROLL as word 3 of Group 1
VRGROUP = GROUP_3
GOSUB talk_phrase6

ELSEIF VRCOMMAND = 4 THEN ' Consider TURN as word 4 of Group 1
VRGROUP = GROUP_4
GOSUB talk_phrase6

ELSEIF VRCOMMAND = 10 THEN ' Consider ATTACK as word 10 of Group 1
VRGROUP = GROUP_5
GOSUB talk_phrase6

ELSE
VRGROUP = GROUP_1 ' back to group 1 commands
ENDIF

ON VRCOMMAND GOTO sleep,MAIN,hands_up,MAIN,MAIN,clap,battery,bow,headstand,wing_move,MAIN
ENDIF

IF VRGROUP = GROUP_2 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_shift,right_shift,forward_move,backward_move
ENDIF

IF VRGROUP = GROUP_3 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_roll,right_roll,forward_roll,back_roll
ENDIF

IF VRGROUP = GROUP_4 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_turn,right_turn
ENDIF

IF VRGROUP = GROUP_5 THEN
VRGROUP = GROUP_1 ' back to group 1 commands
ON VRCOMMAND GOTO left_attack,right_attack,forward_punch
ENDIF


GOTO MAIN

'================================================

k3:
GOSUB sit_down_pose
DELAY 1000
GOSUB standard_pose
GOTO MAIN

k17: ' C
GOSUB left_forward
GOSUB standard_pose
GOTO MAIN

k27: ' D
GOSUB right_forward
GOSUB standard_pose
GOTO MAIN



'================================================

battery: ' [ 10 x Value / 256 = Voltage]

GOSUB led_off
V = AD(1)
VOLT = V*100/256
IF VOLT > 65 THEN
GOSUB talk_phrase27
ELSEIF VOLT >= 63 AND VOLT <= 65 THEN
GOSUB talk_phrase28
ELSEIF VOLT >= 60 AND VOLT <= 62 THEN
GOSUB talk_phrase29
ELSEIF VOLT < 60 THEN
GOSUB talk_phrase30
ENDIF
DELAY 1000
GOSUB ready
GOTO MAIN

'================================================

ready:

GOSUB talk_phrase3
DELAY 1000
GOSUB led_on
RETURN

'================================================

led_on:

OUT 52,0
RETURN

'================================================

led_off:

OUT 52,1
RETURN

'================================================

robot_tilt:

A = AD(0)
IF A > 250 THEN RETURN
IF A < 30 THEN GOTO tilt_low
IF A > 180 THEN GOTO tilt_high
RETURN
tilt_low:
A = AD(0)
IF A < 30 THEN
GOTO backward_standup
ENDIF
RETURN
tilt_high:
A = AD(0)
IF A > 180 THEN
GOTO forward_standup
ENDIF
RETURN

'================================================

standard_pose:

MOVE G6A, 100, 76, 145, 93, 100, 100
MOVE G6D, 100, 76, 145, 93, 100, 100
MOVE G6B, 100, 30, 80, 100, 100, 100
MOVE G6C, 100, 30, 80, 100, 100, 100
WAIT
RETURN

'================================================

sleep:

GOSUB led_off
GOSUB talk_phrase5
SPEED 10
MOVE G6A, 100, 151, 23, 140, 101, 100
MOVE G6D, 100, 151, 23, 140, 101, 100
MOVE G6B, 100, 30, 80, 100, 100, 100
MOVE G6C, 100, 30, 80, 100, 100, 100
WAIT
MOTOROFF G24 ' motor power off
TEMPO 230
GOTO MAIN

'================================================

bow:

GOSUB led_off
GOSUB talk_phrase9
DELAY 2000
MOVE G6A, 100, 58, 135, 160, 100, 100
MOVE G6D, 100, 58, 135, 160, 100, 100
MOVE G6B, 100, 30, 80, , , ,
MOVE G6C, 100, 30, 80, , , ,
WAIT
DELAY 1000
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

hands_up:

GOSUB led_off
SPEED 5
GOSUB talk_phrase12
MOVE G6A, 100, 76, 145, 93, 100
MOVE G6D, 100, 76, 145, 93, 100
MOVE G6B, 100, 168, 150
MOVE G6C, 100, 168, 150
WAIT
GOSUB talk_phrase10
DELAY 3000
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

sit_down_pose:

SPEED 10
MOVE G6A, 100, 151, 23, 140, 101, 100
MOVE G6D, 100, 151, 23, 140, 101, 100
MOVE G6B, 100, 30, 80, 100, 100, 100
MOVE G6C, 100, 30, 80, 100, 100, 100
WAIT
RETURN

'================================================

body_move:

SPEED 6
GOSUB body_move1
GOSUB body_move2
GOSUB body_move3
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B, 100, 105, 100, , , ,
MOVE G6C, 100, 105, 100, , , ,
WAIT
MOVE G6A, 104, 112, 92, 116, 107
MOVE G6D, 79, 81, 145, 95, 108
MOVE G6B, 100, 105, 100
MOVE G6C, 100, 105, 100
WAIT
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B, 100, 105, 100, , , ,
MOVE G6C, 100, 105, 100, , , ,
WAIT
MOVE G6D, 104, 112, 92, 116, 107
MOVE G6A, 79, 81, 145, 95, 108
MOVE G6B, 100, 105, 100
MOVE G6C, 100, 105, 100
WAIT
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B, 100, 105, 100, , , ,
MOVE G6C, 100, 105, 100, , , ,
WAIT
GOSUB body_move3
GOSUB body_move2
GOSUB body_move1
RETURN

body_move3:
MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT
RETURN

body_move2:
MOVE G6D,110, 92, 124, 97, 93, 70
MOVE G6A, 76, 72, 160, 82, 128, 70
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT
RETURN

body_move1:
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT
RETURN

'================================================

wing_move:

GOSUB led_off
GOSUB talk_phrase9

DIM i AS BYTE
SPEED 5

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A, 90, 98, 105, 115, 115, 60
MOVE G6D,116, 74, 145, 98, 93, 60
MOVE G6B,100, 150, 150, 100, 100, 100
MOVE G6C,100, 150, 150, 100, 100, 100
WAIT

MOVE G6A, 90, 121, 36, 105, 115, 60
MOVE G6D,116, 60, 146, 138, 93, 60
MOVE G6B,100, 150, 150, 100, 100, 100
MOVE G6C,100, 150, 150, 100, 100, 100
WAIT

MOVE G6A, 90, 98, 105, 64, 115, 60
MOVE G6D,116, 50, 160, 160, 93, 60
MOVE G6B,145, 110, 110, 100, 100, 100
MOVE G6C,145, 110, 110, 100, 100, 100
WAIT

FOR i = 10 TO 15
SPEED i
MOVE G6B,145, 80, 80, 100, 100, 100
MOVE G6C,145, 80, 80, 100, 100, 100
WAIT

MOVE G6B,145, 120, 120, 100, 100, 100
MOVE G6C,145, 120, 120, 100, 100, 100
WAIT
NEXT i

DELAY 1000
SPEED 6

MOVE G6A, 90, 98, 105, 64, 115, 60
MOVE G6D,116, 50, 160, 160, 93, 60
MOVE G6B,100, 160, 180, 100, 100, 100
MOVE G6C,100, 160, 180, 100, 100, 100
WAIT

MOVE G6A, 90, 121, 36, 105, 115, 60
MOVE G6D,116, 60, 146, 138, 93, 60
MOVE G6B,100, 150, 150, 100, 100, 100
MOVE G6C,100, 150, 150, 100, 100, 100
WAIT
SPEED 4

MOVE G6A, 90, 98, 105, 115, 115, 60
MOVE G6D,116, 74, 145, 98, 93, 60
WAIT

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

GOSUB talk_phrase10
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

headstand:

GOSUB led_off
GOSUB talk_phrase9

SPEED 8
GOSUB fall_forward
GOSUB standard_pose
GOSUB foot_up2
GOSUB standard_pose
GOSUB back_stand_up
DELAY 1000
SPEED 6
GOSUB standard_pose
RETURN

fall_forward:

SPEED 10
MOVE G6A, 100, 155, 25, 140, 100, 100
MOVE G6D, 100, 155, 25, 140, 100, 100
MOVE G6B, 130, 50, 85, 100, 100, 100
MOVE G6C, 130, 50, 85, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B, 150, 60, 90, 100, 100, 100
MOVE G6C, 150, 60, 90, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B, 170, 10, 100, 100, 100, 100
MOVE G6C, 170, 10, 100, 100, 100, 100
WAIT
SPEED 3
MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B, 185, 10, 100, 100, 100, 100
MOVE G6C, 185, 10, 100, 100, 100, 100
WAIT
SPEED 10
MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B, 185, 40, 60, 100, 100, 100
MOVE G6C, 185, 40, 60, 100, 100, 100
WAIT
MOVE G6A, 100, 130, 120, 80, 110, 100
MOVE G6D, 100, 130, 120, 80, 110, 100
MOVE G6B, 125, 160, 10, 100, 100, 100
MOVE G6C, 125, 160, 10, 100, 100, 100
WAIT
RETURN

foot_up2:

SPEED 6
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 110, 30, 80, , , ,
MOVE G6C, 110, 30, 80, , , ,
SPEED 3
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 170, 30, 80, , , ,
MOVE G6C, 170, 30, 80, , , ,
WAIT
DELAY 200
SPEED 6
MOVE G6A, 100, 89, 129, 57, 100, ,
MOVE G6D, 100, 89, 129, 57, 100, ,
MOVE G6B, 180, 30, 80, , , ,
MOVE G6C, 180, 30, 80, , , ,
WAIT
MOVE G6A, 100, 64, 179, 57, 100, ,
MOVE G6D, 100, 64, 179, 57, 100, ,
MOVE G6B, 190, 50, 80, , , ,
MOVE G6C, 190, 50, 80, , , ,
WAIT
DELAY 2000
MOVE G6A, 100, 64, 179, 57, 100, ,
MOVE G6D, 100, 64, 179, 57, 100, ,
MOVE G6B, 190, 50, 80, , , ,
MOVE G6C, 190, 50, 80, , , ,
WAIT
MOVE G6A, 100, 89, 129, 57, 100, ,
MOVE G6D, 100, 89, 129, 57, 100, ,
MOVE G6B, 180, 30, 80, , , ,
MOVE G6C, 180, 30, 80, , , ,
WAIT
SPEED 3
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 170, 30, 80, , , ,
MOVE G6C, 170, 30, 80, , , ,
WAIT
SPEED 6
MOVE G6A, 100, 125, 65, 10, 100, ,
MOVE G6D, 100, 125, 65, 10, 100, ,
MOVE G6B, 110, 30, 80, , , ,
MOVE G6C, 110, 30, 80, , , ,
WAIT
RETURN

back_stand_up:

SPEED 10
MOVE G6A, 100, 130, 120, 80, 110, 100
MOVE G6D, 100, 130, 120, 80, 110, 100
MOVE G6B, 150, 160, 10, 100, 100, 100
MOVE G6C, 150, 160, 10, 100, 100, 100
WAIT
MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B, 185, 40, 60, 100, 100, 100
MOVE G6C, 185, 40, 60, 100, 100, 100
WAIT
MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B, 185, 10, 100, 100, 100, 100
MOVE G6C, 185, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B, 170, 10, 100, 100, 100, 100
MOVE G6C, 170, 10, 100, 100, 100, 100
WAIT
MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B, 150, 60, 90, 100, 100, 100
MOVE G6C, 150, 60, 90, 100, 100, 100
WAIT
MOVE G6A, 100, 155, 25, 140, 100, 100
MOVE G6D, 100, 155, 25, 140, 100, 100
MOVE G6B, 130, 50, 85, 100, 100, 100
MOVE G6C, 130, 50, 85, 100, 100, 100
WAIT

GOSUB talk_phrase10
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

left_turn:

GOSUB led_off
GOSUB talk_phrase12
DIM LT AS BYTE
SPEED 6

FOR LT = 1 TO 6
SPEED 6 'don't lean too fast
'feet together, lean left, stand on left,CGmid-foot
MOVE G6A, 112, 76, 145, 93, 92, 60
MOVE G6D, 85, 71, 152, 91, 112, 60
'arms downish, need hands to clear hips
MOVE G6B, 100, 40, 80, , , ,
WAIT

'right foot fwd, left foot back,
'arms swung opposite (slightly), and slightly out

SPEED 7
MOVE G6A, 113, 75, 145, 97, 93, 60
MOVE G6D, 90, 50, 157, 115, 112, 60
MOVE G6B, 105, 40, 70
MOVE G6C, 90, 40, 70
WAIT
' RETURN
'lean less left so right foot is just touching floor
'right foot fwd, left foot back,
'arms swung opposite (more)

MOVE G6A, 108, 78, 145, 98, 93, 60
MOVE G6D, 95, 43, 169, 110, 110, 60
MOVE G6B, 105, 40, 70
MOVE G6C, 80, 40, 70
WAIT
GOSUB standard_pose
DELAY 500
NEXT LT

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'------------------------------------------------
'P_arms_100_30_80:
'arms down
' MOVE G6B, 100, 30, 80
' MOVE G6C, 100, 30, 80
' RETURN
'------------------------------------------------
'------------------------------------------------
P_arms_100_40_80:
'arms ready stance
MOVE G6B, 100, 40, 80, , , ,
RETURN
'------------------------------------------------

'================================================

right_turn:

GOSUB led_off
GOSUB talk_phrase12
DIM RT AS BYTE
SPEED 6

FOR RT = 1 TO 6

SPEED 6 'don't lean too fast
'feet together, lean right, stand on right,CGmid-foot
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D, 112, 76, 145, 93, 92, 60
'arms downish, need hands to clear hips
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 7
'left foot fwd, right foot back
'arms swung opposite (slightly), and slightly out
MOVE G6A, 90, 50, 157, 115, 112, 60
MOVE G6D, 113, 75, 145, 97, 93, 60
MOVE G6B, 90, 40, 70, , , ,
MOVE G6C, 105, 40, 70, , , ,
WAIT

'lean less right so left foot is just touching floor
'left foot fwd, right foot back,
'arms swung opposite (more)
MOVE G6D, 108, 78, 145, 98, 93, 60
MOVE G6A, 95, 43, 169, 110, 110, 60
MOVE G6C, 105, 40, 70
MOVE G6B, 80, 40, 70
WAIT

GOSUB standard_pose
DELAY 500
NEXT RT

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'-----------------------------------

' MOVE G6A, 85, 71, 152, 91, 112, 60
' MOVE G6D, 112, 76, 145, 93, 92, 60
' MOVE G6B, 100, 40, 80, , , ,
' MOVE G6C, 100, 40, 80, , , ,
' WAIT
' MOVE G6D, 113, 75, 145, 97, 93, 60
' MOVE G6A, 90, 50, 157, 115, 112, 60
' MOVE G6C, 105, 40, 70, , , ,
' MOVE G6B, 90, 40, 70, , , ,
' WAIT
' MOVE G6D, 108, 78, 145, 98, 93, 60
' MOVE G6A, 95, 43, 169, 110, 110, 60
' MOVE G6C, 105, 40, 70, , , ,
' MOVE G6B, 80, 40, 70, , , ,
' WAIT
' NEXT RT

' GOSUB standard_pose
' DELAY 500
' GOSUB ready
' GOTO MAIN

'================================================

forward_move:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5

MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 114, 76, 145, 93, 90, 60,
'---------------------------------------
'left down
MOVE24 90, 56, 143, 122, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 113, 80, 145, 90, 90, 60,
MOVE24 90, 46, 163, 112, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 112, 80, 145, 90, 90, 60,

SPEED 10
'left center
MOVE24 100, 66, 141, 113, 100, 100, 90, 40, 80, , , , 100, 40, 80, , , , 100, 83, 156, 80, 100, 100,
MOVE24 113, 78, 142, 105, 90, 60, 100, 40, 80, , , , 100, 40, 80, , , , 90, 102, 136, 85, 114, 60,

SPEED 14
'right up
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,

'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
MOVE24 112, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 46, 163, 112, 114, 60,

SPEED 10
'right center
MOVE24 100, 83, 156, 80, 100, 100, 100, 40, 80, , , , 90, 40, 80, , , , 100, 66, 141, 113, 100, 100,
MOVE24 90, 102, 136, 85, 114, 60, 100, 40, 80, , , , 100, 40, 80, , , , 113, 78, 142, 105, 90, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 113, 76, 145, 93, 90, 60,
'---------------------------------------

SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

walk:

WALK = 1
SPEED 5
GOSUB talk_phrase12
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 114, 76, 145, 93, 90, 60,
'---------------------------------------
'left down
MOVE24 90, 56, 143, 122, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 113, 80, 145, 90, 90, 60,
MOVE24 90, 46, 163, 112, 114, 60, 80, 40, 80, , , , 105, 40, 80, , , , 112, 80, 145, 90, 90, 60,

SPEED 10
'left center
MOVE24 100, 66, 141, 113, 100, 100, 90, 40, 80, , , , 100, 40, 80, , , , 100, 83, 156, 80, 100, 100,
MOVE24 113, 78, 142, 105, 90, 60, 100, 40, 80, , , , 100, 40, 80, , , , 90, 102, 136, 85, 114, 60,

SPEED 14
'right up
MOVE24 113, 76, 145, 93, 90, 60, 100, 40, 80, , , , 90, 40, 80, , , , 90, 107, 105, 105, 114, 60,

'right down
MOVE24 113, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 56, 143, 122, 114, 60,
MOVE24 112, 80, 145, 90, 90, 60, 105, 40, 80, , , , 80, 40, 80, , , , 90, 46, 163, 112, 114, 60,

SPEED 10
'right center
MOVE24 100, 83, 156, 80, 100, 100, 100, 40, 80, , , , 90, 40, 80, , , , 100, 66, 141, 113, 100, 100,
MOVE24 90, 102, 136, 85, 114, 60, 100, 40, 80, , , , 100, 40, 80, , , , 113, 78, 142, 105, 90, 60,

SPEED 14
'left up
MOVE24 90, 107, 105, 105, 114, 60, 90, 40, 80, , , , 100, 40, 80, , , , 113, 76, 145, 93, 90, 60,
'---------------------------------------

SPEED 5
MOVE24 85, 71, 152, 91, 112, 60, 100, 40, 80, , , , 100, 40, 80, , , , 112, 76, 145, 93, 92, 60,

GOSUB standard_pose

GOTO MAIN

'================================================

left_shift:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5

GOSUB talk_phrase12
MOVE G6A, 85, 71, 152, 91, 112, 60,
MOVE G6D, 112, 76, 145, 93, 92, 60,
MOVE G6B, 100, 40, 80, , , ,
MOVE G6C, 100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6D, 110, 92, 124, 97, 93, 70,
MOVE G6A, 76, 72, 160, 82, 128, 70,
MOVE G6B, 100, 35, 90, , , ,
MOVE G6C, 100, 35, 90, , , ,
WAIT

MOVE G6A, 93, 76, 145, 94, 109, 100,
MOVE G6D, 93, 76, 145, 94, 109, 100,
MOVE G6B, 100, 35, 90, , , ,
MOVE G6C, 100, 35, 90, , , ,
WAIT

MOVE G6A, 110, 92, 124, 97, 93, 70,
MOVE G6D, 76, 72, 160, 82, 128, 70,
MOVE G6B, 100, 35, 90, , , ,
MOVE G6C, 100, 35, 90, , , ,
WAIT

SPEED 7
MOVE G6D, 86, 83, 135, 97, 114, 60,
MOVE G6A, 113, 78, 145, 93, 93, 60,
MOVE G6C, 90, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

MOVE G6D, 85, 71, 152, 91, 112, 60,
MOVE G6A, 112, 76, 145, 93, 92, 60,
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 6
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

sit_down_pose26:

IF A26 = 0 THEN GOTO standard_pose26

A26 = 0
SPEED 10
MOVE G6A,100, 151, 23, 140, 101, 100
MOVE G6D,100, 151, 23, 140, 101, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT

RETURN

standard_pose26:
A26 = 1
MOVE G6A,100, 76, 145, 93, 100, 100
MOVE G6D,100, 76, 145, 93, 100, 100
MOVE G6B,100, 30, 80, 100, 100, 100
MOVE G6C,100, 30, 80, 100, 100, 100
WAIT

RETURN

'================================================

right_shift:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5
MOVE G6D, 85, 71, 152, 91, 112, 60
MOVE G6A, 112, 76, 145, 93, 92, 60
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6A,110, 92, 124, 97, 93, 70
MOVE G6D, 76, 72, 160, 82, 128, 70
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT

MOVE G6A, 93, 76, 145, 94, 109, 100
MOVE G6D, 93, 76, 145, 94, 109, 100
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT

MOVE G6D,110, 92, 124, 97, 93, 70
MOVE G6A, 76, 72, 160, 82, 128, 70
MOVE G6B,100, 35, 90, , , ,
MOVE G6C,100, 35, 90, , , ,
WAIT

SPEED 7
MOVE G6A, 86, 83, 135, 97, 114, 60
MOVE G6D,113, 78, 145, 93, 93, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 6
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

backward_move:

GOSUB led_off
GOSUB talk_phrase12
SPEED 5

MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 13
MOVE G6A, 90, 107, 105, 105, 114, 60
MOVE G6D,113, 78, 145, 93, 90, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6D,113, 76, 142, 105, 90, 60
MOVE G6A, 90, 96, 136, 85, 114, 60
MOVE G6C,100, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT

MOVE G6D,100, 62, 146, 108, 100, 100
MOVE G6A,100, 88, 140, 86, 100, 100
MOVE G6C,90, 40, 80, , ,,
MOVE G6B,100, 40, 80, , , ,
WAIT

MOVE G6D, 90, 56, 143, 122, 114, 60
MOVE G6A,113, 80, 145, 90, 90, 60
MOVE G6C,80, 40, 80, , , ,
MOVE G6B,105, 40, 80, , , ,
WAIT

SPEED 13
MOVE G6D, 90, 107, 105, 105, 114, 60
MOVE G6A,113, 78, 145, 93, 90, 60
MOVE G6C,90, 40, 80, , , ,
MOVE G6B,100, 40, 80, , , ,
WAIT

SPEED 7
MOVE G6A,113, 76, 142, 105, 90, 60
MOVE G6D, 90, 96, 136, 85, 114, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A,100, 62, 146, 108, 100, 100
MOVE G6D,100, 88, 140, 86, 100, 100
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

MOVE G6A, 90, 56, 143, 122, 114, 60
MOVE G6D,113, 80, 145, 90, 90, 60
MOVE G6B, 80, 40, 80, , , ,
MOVE G6C,105, 40, 80, , , ,
WAIT

SPEED 13
MOVE G6A, 90, 107, 105, 105, 114, 60
MOVE G6D,113, 78, 145, 93, 90, 60
MOVE G6B, 90, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

SPEED 5
MOVE G6A, 85, 71, 152, 91, 112, 60
MOVE G6D,112, 76, 145, 93, 92, 60
MOVE G6B,100, 40, 80, , , ,
MOVE G6C,100, 40, 80, , , ,
WAIT

GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

forward_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
GOSUB standard_pose
MOVE G6A,100, 155, 20, 140, 100, 100
MOVE G6D,100, 155, 20, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT

MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,130, 160, 10, 100, 100, 100
MOVE G6C,130, 160, 10, 100, 100, 100
WAIT

MOVE G6A,100, 160, 110, 140, 100, 100
MOVE G6D,100, 160, 110, 140, 100, 100
MOVE G6B,140, 70, 20, 100, 100, 100
MOVE G6C,140, 70, 20, 100, 100, 100
WAIT

SPEED 15
MOVE G6A,100, 56, 110, 26, 100, 100
MOVE G6D,100, 71, 177, 162, 100, 100
MOVE G6B,170, 40, 50, 100, 100, 100
MOVE G6C,170, 40, 50, 100, 100, 100
WAIT

MOVE G6A,100, 62, 110, 15, 100, 100
MOVE G6D,100, 71, 128, 113, 100, 100
MOVE G6B,190, 40, 50, 100, 100, 100
MOVE G6C,190, 40, 50, 100, 100, 100
WAIT

SPEED 15
MOVE G6A,100, 55, 110, 15, 100, 100
MOVE G6D,100, 55, 110, 15, 100, 100
MOVE G6B,190, 40, 50, 100, 100, 100
MOVE G6C,190, 40, 50, 100, 100, 100
WAIT

SPEED 10

MOVE G6A,100, 110, 100, 15, 100, 100
MOVE G6D,100, 110, 100, 15, 100, 100
MOVE G6B,170, 160, 115, 100, 100, 100
MOVE G6C,170, 160, 115, 100, 100, 100
WAIT

MOVE G6A,100, 170, 70, 15, 100, 100
MOVE G6D,100, 170, 70, 15, 100, 100
MOVE G6B,190, 170, 120, 100, 100, 100
MOVE G6C,190, 170, 120, 100, 100, 100
WAIT

MOVE G6A,100, 170, 30, 110, 100, 100
MOVE G6D,100, 170, 30, 110, 100, 100
MOVE G6B,190, 40, 60, 100, 100, 100
MOVE G6C,190, 40, 60, 100, 100, 100
WAIT

GOSUB sit_pose
GOSUB standard_pose
DELAY 500
GOSUB ready
RETURN

'================================================

sit_pose:

SPEED 10
MOVE G6A,100, 151, 23, 140, 101, 100,
MOVE G6D,100, 151, 23, 140, 101, 100,
MOVE G6B,100, 30, 80, 100, 100, 100,
MOVE G6C,100, 30, 80, 100, 100, 100,
WAIT
RETURN

'================================================

left_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

DELAY 100
SPEED 3
MOVE G6A,114, 135, 60, 123, 105, 100
MOVE G6D, 88, 110, 91, 116, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT
DELAY 100
MOVE G6A,114, 135, 60, 123, 105, 100
MOVE G6D,89, 135, 60, 123, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

MOVE G6A,120, 135, 60, 123, 110, 100
MOVE G6D, 89, 135, 60, 123, 130, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,120, 135, 60, 123, 120, 100
MOVE G6D,89, 135, 60, 123, 158, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

SPEED 8
MOVE G6A,120, 131, 60, 123, 185, 100
MOVE G6D,120, 131, 60, 123, 183, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

DELAY 200

SPEED 5
MOVE G6A,120, 131, 60, 123, 185, 100
MOVE G6D,120, 131, 60, 123, 183, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 6
MOVE G6A, 86, 112, 73, 127, 101, 100
MOVE G6D,105, 131, 60, 123, 183, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 3
MOVE G6A, 86, 118, 73, 127, 101, 100
MOVE G6D,112, 131, 62, 123, 133, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 3
MOVE G6A, 88, 115, 86, 115, 90, 100
MOVE G6D,107, 135, 62, 123, 113, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================

forward_punch:

GOSUB led_off
GOSUB talk_phrase12

SPEED 15
MOVE G6A, 92, 100, 110, 100, 107, 100
MOVE G6D, 92, 100, 110, 100, 107, 100
MOVE G6B,190, 150, 10, 100, 100, 100
MOVE G6C,190, 150, 10, 100, 100, 100
WAIT
SPEED 15
HIGHSPEED SETON

MOVE G6B,190, 10, 75, 100, 100, 100
MOVE G6C,190, 140, 10, 100, 100, 100
WAIT
DELAY 500
MOVE G6B,190, 140, 10, 100, 100, 100
MOVE G6C,190, 10, 75, 100, 100, 100
WAIT
DELAY 500

MOVE G6A, 92, 100, 113, 100, 107, 100
MOVE G6D, 92, 100, 113, 100, 107, 100
MOVE G6B,190, 150, 10, 100, 100, 100
MOVE G6C,190, 150, 10, 100, 100, 100
WAIT

HIGHSPEED SETOFF
MOVE G6A,100, 115, 90, 110, 100, 100
MOVE G6D,100, 115, 90, 110, 100, 100
MOVE G6B,100, 80, 60, 100, 100, 100
MOVE G6C,100, 80, 60, 100, 100, 100
WAIT

GOSUB talk_phrase3
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

right_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT
DELAY 100

SPEED 3
MOVE G6A, 83, 110, 91, 116, 100, 100
MOVE G6D,114, 135, 60, 123, 105, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT
DELAY 100

MOVE G6A,89, 135, 60, 123, 100, 100
MOVE G6D,114, 135, 60, 123, 105, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

MOVE G6A, 89, 135, 60, 123, 130, 100
MOVE G6D,120, 135, 60, 123, 110, 100
MOVE G6B,100, 120, 140, 100, 100, 100
MOVE G6C,100, 120, 140, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,89, 135, 60, 123, 158, 100
MOVE G6D,120, 135, 60, 123, 120, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

SPEED 8
MOVE G6A,120, 131, 60, 123, 183, 100
MOVE G6D,120, 131, 60, 123, 185, 100
MOVE G6B,100, 165, 185, 100, 100, 100
MOVE G6C,100, 165, 185, 100, 100, 100
WAIT

DELAY 200

SPEED 5
MOVE G6A,120, 131, 60, 123, 183, 100
MOVE G6D,120, 131, 60, 123, 185, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 6
MOVE G6A,105, 131, 60, 123, 183, 100
MOVE G6D, 86, 112, 73, 127, 101, 100
MOVE G6B,100, 120, 145, 100, 100, 100
MOVE G6C,100, 120, 145, 100, 100, 100
WAIT

SPEED 3
MOVE G6A,112, 131, 62, 123, 133, 100
MOVE G6D, 86, 118, 73, 127, 101, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 3
MOVE G6A,107, 135, 62, 123, 113, 100
MOVE G6D, 88, 115, 89, 115, 90, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

SPEED 4
MOVE G6A,100, 135, 60, 123, 100, 100
MOVE G6D,100, 135, 60, 123, 100, 100
MOVE G6B,100, 80, 80, 100, 100, 100
MOVE G6C,100, 80, 80, 100, 100, 100
WAIT

GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================

back_roll:

GOSUB led_off
GOSUB talk_phrase12
SPEED 8
MOVE G6A, 100, 170, 71, 23, 100, 100
MOVE G6D, 100, 170, 71, 23, 100, 100
MOVE G6B, 80, 50, 70, 100, 100, 100
MOVE G6C, 80, 50, 70, 100, 100, 100
WAIT

MOVE G6A, 100, 133, 71, 23, 100, 100
MOVE G6D, 100, 133, 71, 23, 100, 100
MOVE G6B, 10, 96, 15, 100, 100, 100
MOVE G6C, 10, 96, 14, 100, 100, 100
WAIT

MOVE G6A, 100, 133, 49, 23, 100, 100
MOVE G6D, 100, 133, 49, 23, 100, 100
MOVE G6B, 45, 116, 15, 100, 100, 100
MOVE G6C, 45, 116, 14, 100, 100, 100
WAIT

MOVE G6A, 100, 133, 49, 23, 100, 100
MOVE G6D, 100, 70, 180, 160, 100, 100
MOVE G6B, 45, 50, 70, 100, 100, 100
MOVE G6C, 45, 50, 70, 100, 100, 100
WAIT

SPEED 15
MOVE G6A, 100, 133, 180, 160, 100, 100
MOVE G6D, 100, 133, 180, 160, 100, 100
MOVE G6B, 10, 50, 70, 100, 100, 100
MOVE G6C, 10, 50, 70, 100, 100, 100
WAIT

HIGHSPEED SETON
MOVE G6A, 100, 95, 180, 160, 100, 100
MOVE G6D, 100, 95, 180, 160, 100, 100
MOVE G6B, 160, 50, 70, 100, 100, 100
MOVE G6C, 160, 50, 70, 100, 100, 100
WAIT

HIGHSPEED SETOFF

MOVE G6A, 100, 130, 120, 80, 110, 100
MOVE G6D, 100, 130, 120, 80, 110, 100
MOVE G6B, 130, 160, 10, 100, 100, 100
MOVE G6C, 130, 160, 10, 100, 100, 100
WAIT

GOSUB back_standing
GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================

back_standing:

SPEED 10
MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,150, 160, 10, 100, 100, 100
MOVE G6C,150, 160, 10, 100, 100, 100
WAIT

MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT

MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B,150, 60, 90, 100, 100, 100
MOVE G6C,150, 60, 90, 100, 100, 100
WAIT

MOVE G6A,100, 155, 25, 140, 100, 100
MOVE G6D,100, 155, 25, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT

RETURN

'================================================

left_attack:

GOSUB led_off
GOSUB talk_phrase12

SPEED 7
MOVE G6A, 85, 71, 152, 91, 107, 60
MOVE G6D, 108, 76, 145, 93, 100, 60
MOVE G6B, 100, 40, 80, , , ,
MOVE G6C, 100, 40, 80, , , ,
WAIT

SPEED 12
HIGHSPEED SETON
MOVE G6A, 98, 157, 20, 134, 110, 100
MOVE G6D, 57, 115, 77, 125, 134, 100
MOVE G6B,107, 135, 108, 100, 100, 100
MOVE G6C,112, 92, 99, 100, 100, 100
WAIT
DELAY 1000
HIGHSPEED SETOFF
SPEED 15
GOSUB sit_pose

GOSUB talk_phrase3
GOSUB standard_pose
GOSUB ready
GOTO MAIN



'================================================

right_attack:

GOSUB led_off
GOSUB talk_phrase12

SPEED 7
MOVE G6D, 85, 71, 152, 91, 107, 60
MOVE G6A, 108, 76, 145, 93, 100, 60
MOVE G6C, 100, 40, 80, , , ,
MOVE G6B, 100, 40, 80, , , ,
WAIT

SPEED 12
HIGHSPEED SETON
MOVE G6D, 98, 157, 20, 134, 110, 100
MOVE G6A, 57, 115, 77, 125, 134, 100
MOVE G6B,112, 92, 99, 100, 100, 100
MOVE G6C,107, 135, 108, 100, 100, 100
WAIT
DELAY 1000
HIGHSPEED SETOFF
SPEED 15
GOSUB sit_pose

GOSUB talk_phrase3
GOSUB standard_pose
GOSUB ready
GOTO MAIN

'================================================

left_forward:

SPEED 7

MOVE G6A, 85, 71, 152, 91, 107, 60
MOVE G6D, 108, 76, 145, 93, 100, 60
MOVE G6B, 130, 40, 80, , , ,
MOVE G6C, 70, 40, 80, , , ,
WAIT

SPEED 12
HIGHSPEED SETON

MOVE G6A, 107, 164, 21, 125, 93
MOVE G6D, 66, 163, 85, 65, 130
MOVE G6B, 189, 40, 77
MOVE G6C, 50, 72, 86
WAIT

DELAY 1000
HIGHSPEED SETOFF

GOSUB sit_pose
RETURN


'================================================

right_forward:

SPEED 7
MOVE G6D, 85, 71, 152, 91, 107, 60
MOVE G6A, 108, 76, 145, 93, 100, 60
MOVE G6C, 130, 40, 80, , , ,
MOVE G6B, 70, 40, 80, , , ,
WAIT

SPEED 10
HIGHSPEED SETON
MOVE G6D, 107, 164, 21, 125, 93
MOVE G6A, 66, 163, 85, 65, 130
MOVE G6C, 189, 40, 77
MOVE G6B, 50, 72, 86
WAIT

DELAY 1000
HIGHSPEED SETOFF

GOSUB sit_pose
RETURN

'================================================

forward_standup:

SPEED 10

MOVE G6A,100, 130, 120, 80, 110, 100
MOVE G6D,100, 130, 120, 80, 110, 100
MOVE G6B,150, 160, 10, 100, 100, 100
MOVE G6C,150, 160, 10, 100, 100, 100
WAIT

MOVE G6A, 80, 155, 85, 150, 150, 100
MOVE G6D, 80, 155, 85, 150, 150, 100
MOVE G6B,185, 40, 60, 100, 100, 100
MOVE G6C,185, 40, 60, 100, 100, 100
WAIT

MOVE G6A, 75, 165, 55, 165, 155, 100
MOVE G6D, 75, 165, 55, 165, 155, 100
MOVE G6B,185, 10, 100, 100, 100, 100
MOVE G6C,185, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 30, 165, 155, 100
MOVE G6D, 60, 165, 30, 165, 155, 100
MOVE G6B,170, 10, 100, 100, 100, 100
MOVE G6C,170, 10, 100, 100, 100, 100
WAIT

MOVE G6A, 60, 165, 25, 160, 145, 100
MOVE G6D, 60, 165, 25, 160, 145, 100
MOVE G6B,150, 60, 90, 100, 100, 100
MOVE G6C,150, 60, 90, 100, 100, 100
WAIT

MOVE G6A,100, 155, 25, 140, 100, 100
MOVE G6D,100, 155, 25, 140, 100, 100
MOVE G6B,130, 50, 85, 100, 100, 100
MOVE G6C,130, 50, 85, 100, 100, 100
WAIT

GOSUB standard_pose
RETURN

'================================================

backward_standup:

SPEED 10

MOVE G6A,100, 10, 100, 115, 100, 100
MOVE G6D,100, 10, 100, 115, 100, 100
MOVE G6B,100, 130, 10, 100, 100, 100
MOVE G6C,100, 130, 10, 100, 100, 100
WAIT

MOVE G6A,100, 10, 83, 140, 100, 100
MOVE G6D,100, 10, 83, 140, 100, 100
MOVE G6B, 20, 130, 10, 100, 100, 100
MOVE G6C, 20, 130, 10, 100, 100, 100
WAIT

MOVE G6A,100, 126, 60, 50, 100, 100
MOVE G6D,100, 126, 60, 50, 100, 100
MOVE G6B, 20, 30, 90, 100, 100, 100
MOVE G6C, 20, 30, 90, 100, 100, 100
WAIT

MOVE G6A,100, 165, 70, 15, 100, 100
MOVE G6D,100, 165, 70, 15, 100, 100
MOVE G6B, 30, 20, 95, 100, 100, 100
MOVE G6C, 30, 20, 95, 100, 100, 100
WAIT

MOVE G6A,100, 165, 40, 100, 100, 100
MOVE G6D,100, 165, 40, 100, 100, 100
MOVE G6B,110, 70, 50, 100, 100, 100
MOVE G6C,110, 70, 50, 100, 100, 100
WAIT

GOSUB standard_pose
RETURN
'=================================================

clap:

GOSUB led_off
GOSUB talk_phrase12
DIM hci AS BYTE 'loop counter
SPEED 10
WAIT

HIGHSPEED SETON

MOVE G6C, 145, 20, 70, , , ,
MOVE G6B, 145, 20, 70, , , ,

FOR hci = 0 TO 1
MOVE G6C, 145, 20, 40, , , ,
MOVE G6B, 145, 20, 40, , , ,
WAIT

MOVE G6C, 145, 15, 25, , , ,
MOVE G6B, 145, 15, 25, , , ,
WAIT

MOVE G6C, 145, 20, 40, , , ,
MOVE G6B, 145, 20, 40, , , ,
WAIT
DELAY 100

MOVE G6C, 145, 15, 25, , , ,
MOVE G6B, 145, 15, 25, , , ,
WAIT

MOVE G6C, 155, 20, 40, , , ,
MOVE G6B, 155, 20, 40, , , ,
WAIT
DELAY 100

MOVE G6C, 155, 15, 25, , , ,
MOVE G6B, 155, 15, 25, , , ,
WAIT

MOVE G6C, 155, 20, 40, , , ,
MOVE G6B, 155, 20, 40, , , ,
WAIT

DELAY 400
NEXT hci

MOVE G6C, 145, 20, 70, , , ,
MOVE G6B, 145, 20, 70, , , ,

HIGHSPEED SETOFF
GOSUB standard_pose
DELAY 500
GOSUB ready
GOTO MAIN

'================================================
'SP03 SPEECH
'================================================

talk_phrase1: 'MY POWER IS ON
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H01 'Speak phrase 1
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase2: 'YES ALAN
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H02 'Speak phrase 2
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase3: 'OK, WHAT NEXT
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H03 'Speak phrase 3
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase4: 'SORRY PLEASE REPEAT THAT
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H04 'Speak phrase 4
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase5: 'GOODBYE ALAN
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H05 'Speak phrase 5
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase6: 'WHICH WAY
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H06 'Speak phrase 6
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase7: 'READY
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H07 'Speak phrase 7
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase8:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H08 'Speak phrase 8
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase9: 'HELLO ALAN
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H09 'Speak phrase 9
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase10: 'MY HANDS ARE NOW UP
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0A 'Speak phrase 10
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase11: '
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0B 'Speak phrase 11
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase12: 'OK
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0C 'Speak phrase 12
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase13: '
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0D 'Speak phrase 13
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase14: '
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0E 'Speak phrase 14
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase15:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H0F 'Speak phrase 15
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase16:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H10 'Speak phrase 16
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase17:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H11 'Speak phrase 17
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase18:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H12 'Speak phrase 18
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase19:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H13 'Speak phrase 19
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase20:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H14 'Speak phrase 20
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase21:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H15 'Speak phrase 21
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase22:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H16 'Speak phrase 22
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase23:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H17 'Speak phrase 23
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase24:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H18 'Speak phrase 24
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase25:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H19 'Speak phrase 25
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase26:
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1A 'Speak phrase 26
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase27: 'MY BATTERY IS FULLY CHARGED
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1B 'Speak phrase 27
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase28: 'MY BATTERY LEVEL IS GOOD
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1C 'Speak phrase 28
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase29: 'MY BATTERY IS GETTING LOW
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1D 'Speak phrase 29
GOSUB I2cByteWrite
RETURN

'================================================

talk_phrase30: 'MY BATTERY LEVEL IS VERY LOW. PLEASE RECHARGE ME
I2cAddr = &Hc4 'SP03 default address
I2cReg = 0 'Command Register
I2cData = &H1E 'Speak phrase 30
GOSUB I2cByteWrite
RETURN

'================================================

FillSpeechBuffer_ready:
GOSUB I2cStart 'Start sequence
I2cBuf = I2cAddr
GOSUB I2cOutByte 'Send SP03 address
I2cBuf = 0
GOSUB I2cOutByte 'Select Command Register
GOSUB I2cOutByte 'Send NOP
GOSUB I2cOutByte 'Max volume = Zero??
I2cBuf = &H05
GOSUB I2cOutByte 'Speech Speed
I2cBuf = &H03
GOSUB I2cOutByte 'Speech Pitch
'** Followed by the ASCII characters (85 maximum) of the words you would like RN to say
I2cBuf = &H52 'R
GOSUB I2cOutByte
I2cBuf = &H65 'e
GOSUB I2cOutByte
I2cBuf = &H61 'a
GOSUB I2cOutByte
I2cBuf = &H64 'd
GOSUB I2cOutByte
I2cBuf = &H79 'y
GOSUB I2cOutByte
I2cBuf = 0 'Nul
GOSUB I2cOutByte
GOSUB I2cStop
DELAY 2
RETURN

'================================================

FillSpeechBuffer_hello:
GOSUB I2cStart 'Start sequence
I2cBuf = I2cAddr
GOSUB I2cOutByte 'Send SP03 address
I2cBuf = 0
GOSUB I2cOutByte 'Select Command Register
GOSUB I2cOutByte 'Send NOP
GOSUB I2cOutByte 'Max volume = Zero??
I2cBuf = &H05
GOSUB I2cOutByte 'Speech Speed
I2cBuf = &H03
GOSUB I2cOutByte 'Speech Pitch
'** Followed by the ASCII characters (85 maximum) of the words you would like RN to say for example, Hello
I2cBuf = &H48 'H
GOSUB I2cOutByte
I2cBuf = &H65 'e
GOSUB I2cOutByte
I2cBuf = &H6C 'l
GOSUB I2cOutByte
I2cBuf = &H6C 'l
GOSUB I2cOutByte
I2cBuf = &H06F 'o
GOSUB I2cOutByte
I2cBuf = 0 'Nul
GOSUB I2cOutByte
GOSUB I2cStop
DELAY 2
RETURN

'================================================

I2cByteWrite:
GOSUB I2cStart
I2cBuf = I2cAddr
GOSUB I2cOutByte
I2cBuf = I2cReg
GOSUB I2cOutByte
I2cBuf = I2cData
GOSUB I2cOutByte
GOSUB I2cStop
RETURN

'================================================

I2cByteRead:
GOSUB I2cStart
I2cBuf = I2cAddr
GOSUB I2cOutByte
I2cBuf = I2cReg
GOSUB I2cOutByte
GOSUB I2cStart 'the required repeated start bit
I2cBuf = I2cAddr OR 1
GOSUB I2cOutByte
GOSUB I2cInByte
I2cData = I2cBuf
GOSUB I2cStop
RETURN

'================================================

I2cOutByte:
FOR I2cBit = 0 TO 7
I2cTx = I2cBuf AND &H80
IF I2cTx <> 0 THEN
OUT SDA,1
ELSE
OUT SDA,0
ENDIF
'DELAY 1
OUT SCL, 1
'DELAY 1
OUT SCL, 0
'DELAY 1
I2cBuf = I2cBuf << 1
NEXT I2cBit
OUT SDA, 0
'DELAY 1
OUT SCL, 1
'DELAY 1
OUT SCL, 0
RETURN

'================================================

I2cInByte:
I2cBuf =0
OUT SDA, 1
I2cRx = IN(SDA)
FOR I2cBit = 0 TO 7
OUT SCL, 1
'DELAY 1
I2cRx = IN(SDA)
OUT SCL, 0
'DELAY 1
I2cBuf = I2cBuf << 1
IF I2cRx <> 0 THEN
I2cBuf = I2cBuf +1
ENDIF
'DELAY 1
NEXT I2cBit
OUT SDA, 0
'DELAY 1
OUT SCL, 1
'DELAY 1
OUT SCL, 0
'DELAY 1
RETURN

'================================================

I2cStart:
OUT SDA,1
'DELAY 1
OUT SCL,1
'DELAY 1
OUT SDA,0
'DELAY 1
OUT SCL,0
'DELAY 1
RETURN

'================================================

I2cStop:
OUT SCL,1
'DELAY 1
OUT SDA,1
RETURN

'================================================
'================================================
ozfiddler offline
Savvy Roboteer
Savvy Roboteer
Posts: 93
Joined: Tue Oct 26, 2010 1:01 am

Re: vrBot issues.

Post by serithseraki » Wed Apr 16, 2014 9:42 pm

Post by serithseraki
Wed Apr 16, 2014 9:42 pm

Good on you, this will make troubleshooting the code a breeze. Now my only issue is to get a copy of RoboBasic 2.72, since after talking with the tigal helpdesk crew who now produce the Veear products 2.5 is not compatible at all... Thus why I kept getting those pesky syntax errors.
Good on you, this will make troubleshooting the code a breeze. Now my only issue is to get a copy of RoboBasic 2.72, since after talking with the tigal helpdesk crew who now produce the Veear products 2.5 is not compatible at all... Thus why I kept getting those pesky syntax errors.
serithseraki offline
Savvy Roboteer
Savvy Roboteer
Posts: 75
Joined: Wed Oct 21, 2009 6:31 pm

Re: vrBot issues.

Post by ozfiddler » Wed Apr 16, 2014 11:26 pm

Post by ozfiddler
Wed Apr 16, 2014 11:26 pm

Don't forget I have set up a resources page with some useful Robonova stuff..... V2.72 is available there for downloading.

http://simplycomputing.com.au/robots/robonova-resources
Don't forget I have set up a resources page with some useful Robonova stuff..... V2.72 is available there for downloading.

http://simplycomputing.com.au/robots/robonova-resources
ozfiddler offline
Savvy Roboteer
Savvy Roboteer
Posts: 93
Joined: Tue Oct 26, 2010 1:01 am


5 postsPage 1 of 1
5 postsPage 1 of 1