davidbuckley.net |
home > Bambino > Programs 1 to 16 | Programs 17 to 21 | Programs 22 to 28 | 14 January 2012 |
Developer Programming instructions
Now you have built Bambino you can either just use it with the preloaded program or you can learn about robots and programming by following the programs I wrote while creating the original Bambino.All the programs are in the program ZIP file available for download from the main Bambino page.
You will need the PicAxe Programming Editor
available from
http://www.picaxe.com/Software/PICAXE/PICAXE-Programming-Editor
then
unpack the programs from the ZIP file using WinZIP or a similar program
and then load them into the PicAxe Programming Editor.
(It is recommended that you use the programs from the ZIP file.)
Or you can copy from the listings below and paste each program into the editor.
'Bambino-01 Sertxd("B01",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'The program makes a sound and toggles the four orange LEDs. 'It uses ' - the Speaker and red Mouth LED, ' - the four orange LEDs symbol VoiceLed_ =c.5 'low =>LED on symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on initialise: high eyeLedL_ 'make output and turn off high eyeLedR_ 'make output and turn off high whiskerLedL_ 'make output and turn off high whiskerLedR_ 'make output and turn off start: let b0 = b0 + 1 'increment b0, 'when the byte variable b0 reaches 255 it will increment to 0 sound VoiceLed_,(b0,2) 'make a sound toggle eyeLedL_ 'alter eyeL toggle eyeLedR_ 'alter eyeR toggle whiskerLedL_ 'alter whiskerL toggle whiskerLedR_ 'alter whiskerR goto start 'loop back to start
'Bambino-02 Sertxd("B02",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Test InfraRed input '------------------- ' receive IR code and send it to the PC; ' open the Terminal window [F8] to see the codes; ' set the baud to 4800; ' if you are not using the PicAxe controller TVR010 ' then you will need to write down which keys give which codes; symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 '================================================================= 'TVR010 PicAxe IR-controller '--------------------------- 'Before use, the transmitter must be programmed with the Sony transmit code. '1. Insert 2 AAA size batteries, preferably alkaline. '2. Press S and B at the same time. S is in the centre of the arrows. ' The top left red LED should light. '3. Press 0. The LED should flash. '4. Press 1. The LED should flash. '5. Press 3. The LED should go out. '6. Press the red power button (top right). '------------------------------------------- 'IRin cmnds PicAxe controller 'DO NOT PRESS OTHER KEYS 'ie [A] [B] [C] [D] [E] [F] [G] 'They change the Mode and [B] has to be pressed to change back. '[square] [triangle [()] [L] [X] [backwards F] have no effect Symbol KEY_POWER = 21 Symbol KEY_UP = 16 Symbol KEY_DOWN = 17 Symbol KEY_RIGHT = 18 Symbol KEY_LEFT = 19 Symbol KEY_BAR = 96 Symbol KEY_TENT = 54 Symbol KEY_VERT_CROSS = 37 Symbol KEY_VCROSS = 37 'synonym for easier coding Symbol KEY_DIAG_CROSS = 20 Symbol KEY_XCROSS = 20 'synonym for easier coding symbol IRkey1 = 0 symbol IRkey2 = 1 symbol IRkey3 = 2 symbol IRkey4 = 3 symbol IRkey5 = 4 symbol IRkey6 = 5 symbol IRkey7 = 6 symbol IRkey8 = 7 symbol IRkey9 = 8 Symbol KEY_MINUS = 98 Symbol KEY_0 = 9 Symbol KEY_PLUS = 11 '================================================================= initialise: low eyeLedR_ 'make output and off low eyeLedL_ 'make output and off start: let b0 = b0 + 1 'increment b0 sound VoiceLed_,(b0,2) 'make a sound toggle eyeLedR_ 'alter eyeR toggle eyeLedL_ 'alter eyeL irin [100,start],iIRin,b1 'irin with timeout ' irin iIRin,b1 'irin with no timeout sertxd (#b1," ",cr) 'send value back to PC goto start 'loop back to start
'Bambino-02a Sertxd("B02a",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Test Eye light values '--------------------- ' open the Terminal window [F8] to see the values; ' set the baud to 4800; symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol eyeR =c.7 symbol eyeL =c.1 initialise: high eyeLedR_ 'make output LED off high eyeLedL_ 'make output LED off start: high eyeLedR_ 'eyeR off whiskerL: readadc c.1,b1 'dark low eyeLedL_ 'eyeR on readadc c.1,b2 'light high eyeLedL_ 'eyeR off if b1>b2 then whiskerL ' b3 =b2 -b1 b3 =b2 -b1 *256 /b2 'scale sertxd ("L ",#b1," ",#b2," ",#b3,":") 'send value back to PC pause 100 whiskerR: readadc c.7,b1 'dark low eyeLedR_ 'eyeR on readadc c.7,b2 'light high eyeLedR_ 'eyeR off if b1>b2 then whiskerR ' b3 =b2 -b1 b3 =b2 -b1 *256 /b2 'scale sertxd ("R ",#b1," ",#b2," ",#b3,"--",cr) 'send value back to PC pause 100 goto start 'loop back to start
'Bambino-02a Sertxd("B02b",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Test Whisker light values '------------------------- ' open the Terminal window [F8] to see the values; ' set the baud to 4800; symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol eyeR =c.7 symbol eyeL =c.1 symbol whiskerL =b.6 'whisker Down Left symbol whiskerR =b.0 'whisker Down Right 'edit holedetect values so Bambino can see table edges 'detected values should 'be grater than the holedetect values when not at an edge 'and lower when at an edge symbol holedetectL =50 'scaled light level difference for hole symbol holedetectR =50 'scaled light level difference for hole write 253,holedetectL 'store for future programs write 252,holedetectR 'store for future programs initialise: high whiskerLedL_ 'make output, whisker LED off high whiskerLedR_ 'make output, whisker LED off start: ReadwhiskerL: readadc b.6,b1 'dark low whiskerLedL_ 'LED on readadc b.6,b2 'light high whiskerLedL_ 'LED off if b1>b2 then ReadwhiskerL b3 =b2 -b1 *256 /b2 'scale sertxd ("L ",#b1," ",#b2," ",#b3," ") 'home, send value back to PC if b3<holedetectL then sertxd("edge",cr) endif ReadwhiskerR: readadc b.0,b1 'dark low whiskerLedR_ 'LED on low whiskerLedL_ 'LED on readadc b.0,b2 'light high whiskerLedR_ 'LED off high whiskerLedL_ 'LED off if b1>b2 then ReadwhiskerR b3 =b2 -b1 *256 /b2 'scale sertxd ("R ",#b1," ",#b2," ",#b3," ",cr)',"--",cr) 'send value back to PC if b3<holedetectR then sertxd("edge",cr) endif pause 200 goto start 'loop back to start
'Bambino-03 Sertxd("B03",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 '------------------------------------------------------ symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol eyeR =c.7 symbol eyeL =c.1 'TVR010 PicAxe IR-controller '--------------------------- 'Before use, the transmitter must be programmed with the Sony transmit code. '1. Insert 2 AAA size batteries, preferably alkaline. '2. Press S and B at the same time. S is in the centre of the arrows. ' The top left red LED should light. '3. Press 0. The LED should flash. '4. Press 1. The LED should flash. '5. Press 3. The LED should go out. '6. Press the red power button (top right). '------------------------------------------- 'IRin cmnds PicAxe controller Symbol KEY_POWER = 21 Symbol KEY_UP = 16 Symbol KEY_DOWN = 17 Symbol KEY_RIGHT = 18 Symbol KEY_LEFT = 19 symbol IRkey1 = 0 symbol IRkey2 = 1 symbol IRkey3 = 2 symbol IRkey4 = 3 symbol IRkey5 = 4 symbol IRkey6 = 5 symbol IRkey7 = 6 symbol IRkey8 = 7 symbol IRkey9 = 8 Symbol KEY_MINUS = 98 Symbol KEY_0 = 9 Symbol KEY_PLUS = 11 Symbol KEY_BAR = 96 Symbol KEY_TENT = 54 Symbol KEY_VERT_CROSS = 37 Symbol KEY_DIAG_CROSS = 20 initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output start: toggle eyeLedR_ 'flash eyeR while waiting toggle eyeLedL_ 'flash eyeR while waiting irin [100,start],iIRin,b1 'irin with timeout on b1 goto play0,play1,play2,play3,beep 'if b1>3 then ignore command goto start 'loop back to start play0: play VoiceLed_,0 goto start 'loop back to start play1: play VoiceLed_,1 goto start 'loop back to start play2: play VoiceLed_,2 goto start 'loop back to start play3: play VoiceLed_,3 goto start 'loop back to start beep: sound VoiceLed_,(150,10) goto start 'loop back to start
'Bambino-04 Sertxd("B04",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Set servos to mid position '-------------------------- ' remove horn screws ' remove horns from servos ' run program ' attach horns so ' feet are side by side ' feet are both flat on the ground ' fasten the horns with the screws symbol servopace =c.0 symbol servoroll =c.4 symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol eyeR =c.7 symbol eyeL =c.1 symbol iIRin =c.6 symbol oIRout =b.2 initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output start: toggle eyeLedR_ 'flash eyeR so we know program is running toggle eyeLedL_ 'flash eyeL so we know program is running pulsout servopace,150 'pulse servo 1.5ms pulsout servoroll,150 'pulse servo 1.5ms pause 20 'pause 20ms goto start 'loop back to start
'Bambino-05 Sertxd("B05",cr) 'report program number #PicAxe 20M2 #no_data read 255,b1 Sertxd("255 is ",#b1,cr) 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Calibrate servo mid positions. '----------------------------- 'The pulsout value must be between 100 and 200 otherwise the servo may be damaged. 'Because of the way each servo is made and ' the horns can only be put on about every 15 degrees ' the feet may not be exactly side by side or flat on the ground. 'Edit the servo mid positions, rollC and paceC, and ' reload the program until the feet are in the right position.. 'The calibrated values are stored in EEPROM for further programs. symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol eyeR =c.7 symbol eyeL =c.1 symbol iIRin =c.6 symbol oIRout =b.2 symbol rollC =155 '100 is roll to the left symbol paceC =150 '100 is left foot back write 254,rollC 'save for other programs write 255,paceC 'save for other programs initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output start: toggle eyeLedR_ 'flash eyeR so we know program is running toggle eyeLedL_ 'flash eyeR so we know program is running pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 20 'pause 20ms goto start 'loop back to start
'Bambino-06 Sertxd("B06",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Introduce _iStand:- initialise with feet in mid position '-------------------------------------------------------- 'modified '-------- 'initialise: 'New '--- 'i '_iStand: symbol oservopace =c.0 'left connector symbol oservoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol i =b2 initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'flash eyeR so we know program is running toggle eyeLedL_ 'flash eyeR so we know program is running pause 20 'pause 20ms goto start 'loop back to start _iStand: 'initialise with feet in mid position for i=0 to 10 pulsout oservopace,paceC 'pulse servo paceC pulsout oservoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next i return
'Bambino-07 Sertxd("B07",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Set rollR '--------- 'edit rollR and reload program until left foot is just off the ground 'modified '-------- 'initialise: 'start '_iStand 'New '--- 'rollR 'rollspeed 'rollat 'sframe: '_rollR symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol i =b2 symbol rollat =b3 symbol rollR =rollC+15 symbol rollspeed =1 symbol sframe =20 'time between servo pulses initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollR end _rollR: for i=rollat to rollR step rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _iStand: 'initialise with feet in mid position for i=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next i rollat =rollC return
'Bambino-08 Sertxd("B08",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Set rollL '--------- 'edit rollL and reload program ' until left foot is just off the ground. 'modified '-------- 'start: 'New '--- 'rollL '_rollL: symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol i =b2 symbol rollat =b3 symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =1 symbol sframe =20 'time between servo pulses initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollL end _rollL: for i=rollat to rollL step -rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _rollR: for i=rollat to rollR step rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _iStand: 'initialise with feet in mid position for i=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next i rollat =rollC return
'Bambino-09 Sertxd("B09",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Check rollR, rollL '------------------ 'edit rollR and rollL and reload program ' until left and right roll is equal ' You might have to take out the download cable to ' check what is right, because it pulls the robot. 'Investigate effect of rollspeed '------------------------------- 'edit rollspeed to see how Woodly performs 'modified '-------- 'start: 'New '--- symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol i =b2 symbol rollat =b3 symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =3 '4 is too fast, 0 won't move symbol sframe =20 'time between servo pulses initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollR toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollL goto start _rollL: for i=rollat to rollL step -rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _rollR: for i=rollat to rollR step rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _iStand: 'initialise with feet in mid position for i=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next i rollat =rollC return
'Bambino-10 Sertxd("B10",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Introduction of _Stand '---------------------- 'You might have to take out the download cable to check what is right, because it pulls the robot. 'modified '-------- 'initialise: 'start: 'New '--- 'i2 'Stand 'stand with both feet flat symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol i =b2 symbol i2 =b3 symbol rollat =b4 symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =3 '4 is too fast, 0 won't move symbol sframe =20 'time between servo pulses initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: for i2=1 to 5 toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollR toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollL next i2 for i2=1 to 5 toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollR gosub Stand pause 500 toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollL gosub Stand pause 500 next i2 goto start Stand: 'stand with both feet flat if rollat<rollC then _StandR _StandL: for i=rollat to rollC step -rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _StandR: for i=rollat to rollC step rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _rollL: for i=rollat to rollL step -rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _rollR: for i=rollat to rollR step rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _iStand: 'initialise with feet in mid position for i=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next i rollat =rollC return
'Bambino-11 Sertxd("B11",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Bambino-11 'Investigate effect of rollspeed; watch roll for all three speeds 'Investigate effect of rollspeed with rollat a variable '------------------------------------------------------ 'watch roll for all three speeds ' You might have to take out the download cable to ' check what is right, because it pulls the robot. 'modified '-------- 'initialise: 'start: 'New '--- 'rollspeed is now a variable symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol i =b2 symbol i2 =b3 symbol rollat =b4 symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =b6 '4 is too fast, 0 won't move symbol sframe =20 'time between servo pulses initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand rollspeed =1 start: for i2=1 to 5 toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollR toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollL next i2 rollspeed =rollspeed +1 if rollspeed>3 then initialise goto start Stand: if rollat<rollC then _StandR _StandL: for i=rollat to rollC step -rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _StandR: for i=rollat to rollC step rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _rollL: for i=rollat to rollL step -rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _rollR: for i=rollat to rollR step rollspeed rollat =i pulsout servoroll,rollat 'pulse servo pause sframe next i return _iStand: 'initialise with feet in mid position for i=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next i rollat =rollC return
'Bambino-12 Sertxd("B12",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Bambino-11 'Investigate effect of rollspeed; watch roll for all three speeds 'Bambino-12 'Investigate effect of rollspeed; watch Roll and Stand for all three speeds 'Investigate effect of rollspeed '------------------------------- 'watch Roll and Stand for all three speeds ' You might have to take out the download cable to ' check what is right, because it pulls the robot. 'modified '-------- 'start: 'New '--- symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol spulse =b2 symbol i2 =b3 symbol rollat =b4 symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =b6 '4 is too fast, 0 won't move symbol sframe =20 'time between servo pulses initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand rollspeed =1 start: for i2=1 to 3 toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollR toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollL next i2 for i2=1 to 3 toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollR gosub Stand pause 500 toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _rollL gosub Stand pause 500 next i2 rollspeed =rollspeed +1 if rollspeed>3 then initialise goto start Stand: if rollat<rollC then _StandR _StandL: for spulse=rollat to rollC step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pause sframe next spulse return _StandR: for spulse=rollat to rollC step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pause sframe next spulse return _rollL: for spulse=rollat to rollL step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pause sframe next spulse return _rollR: for spulse=rollat to rollR step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pause sframe next spulse return _iStand: 'initialise with feet in mid position for spulse=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next spulse rollat =rollC return
'Bambino-13 Sertxd("B13",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Bambino-11 'Investigate effect of rollspeed; watch roll for all three speeds 'Bambino-12 'Investigate effect of rollspeed; watch Roll and Stand for all three speeds 'Bambino-13 'Check paceFL paceFR; Investigate effect of pacespeed 'Check paceFL paceFR '------------------- 'edit paceFL and paceFR and reload program ' until left and right pace is equal 'Investigate effect of pacespeed '------------------------------- 'edit pacespeed to see how Bambino performs 'modified '-------- 'init 'start '_StandL: '_StandR '_rollL '_rollR 'New '--- 'paceat 'paceFR 'Right foot forward 'paceFL 'Left foot forward 'pacespeed '_RF '_LF symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol rollC =150 '100 is roll to the left symbol paceC =150 '100 is left foot back symbol spulse =b2 'symbol i2 =b3 symbol rollat =b4 symbol paceat =b5 symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =b6 '4 is too fast, 0 won't move symbol paceFR =paceC-20 'Right foot forward symbol paceFL =paceC+20 'Left foot forward symbol paceFRmax =100 'Right foot forward symbol paceFLmax =190 'Left foot forward symbol sframe =20 'time between servo pulses symbol pacespeed =b7 '6 is about max for servos to keep up initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand pacespeed =6 start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub _RF pause 500 gosub _LF pause 500 goto start _RF: for spulse=paceat to paceFR step -pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return _LF: for spulse=paceat to paceFL step pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return Stand: 'stand with both feet flat if rollat<rollC then _StandR _StandL: for spulse=rollat to rollC step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _StandR: for spulse=rollat to rollC step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollL: for spulse=rollat to rollL step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollR: for spulse=rollat to rollR step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _iStand: 'initialise with feet in mid position for spulse=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next spulse rollat =rollC paceat =paceC return
'Bambino-14 Sertxd("B14",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Bambino-11 'Investigate effect of rollspeed; watch roll for all three speeds 'Bambino-12 'Investigate effect of rollspeed; watch Roll and Stand for all three speeds 'Bambino-13 'Check paceFL paceFR; Investigate effect of pacespeed 'Bambino-14 'Check Fd 'Check paceFL paceFR '------------------- 'edit paceFL and paceFR and reload program ' until left and right pace are equal 'Investigate effect of rollspeed '------------------------------- 'edit pacespeed to see how Bambino performs 'modified '-------- 'start: 'New '--- 'Fd: symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol spulse =b2 'symbol i =b3 symbol rollat =b4 symbol paceat =b5 symbol rollC =150 '100 is roll to the left symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =b6 '4 is too fast, 0 won't move rollspeed =2 '4 is too fast, 0 won't move symbol paceC =150 '100 is left foot back symbol paceFR =paceC-20 'Right foot forward symbol paceFL =paceC+20 'Left foot forward symbol paceFRmax =100 'Right foot forward symbol paceFLmax =190 'Left foot forward symbol sframe =20 'time between servo pulses symbol pacespeed =b7 '6 is about max for servos to keep up pacespeed =5 '6 is about max for servos to keep up initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub Fd goto start Fd: sertxd (" Fd") if paceat<paceC then _FdL 'else _FdR _FdR: 'sertxd ("_FdR") gosub _rollL gosub _RF gosub Stand return _FdL: 'sertxd ("_FdL") gosub _rollR gosub _LF gosub Stand return _RF: 'sertxd ("_RF") for spulse=paceat to paceFR step -pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return _LF: 'sertxd ("_LF") for spulse=paceat to paceFL step pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return Stand: 'stand with both feet flat sertxd (" Sd") if rollat<rollC then _StandR 'else _StandL _StandL: 'sertxd ("_SL") for spulse=rollat to rollC step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _StandR: 'sertxd ("_SR") for spulse=rollat to rollC step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollL: 'sertxd ("_rL") for spulse=rollat to rollL step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollR: 'sertxd ("_rR") for spulse=rollat to rollR step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _iStand: 'initialise with feet in mid position for spulse=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next spulse rollat =rollC paceat =paceC return
'Bambino-15 Sertxd("B15",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Bambino-11 'Investigate effect of rollspeed; watch roll for all three speeds 'Bambino-12 'Investigate effect of rollspeed; watch Roll and Stand for all three speeds 'Bambino-13 'Check paceFL paceFR; Investigate effect of pacespeed 'Bambino-14 'Check Fd 'Bambino-15 'Test Rt, Lt 'Test Rt, Lt '------------- ' edit rollC to tune the turns 'modified '-------- 'start: 'New '--- 'Rt 'Lt symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol spulse =b2 'symbol i =b3 symbol rollat =b4 symbol paceat =b5 symbol rollC =150 '100 is roll to the left symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =b6 '4 is too fast, 0 won't move rollspeed =1 '4 is too fast, 0 won't move symbol paceC =150 '100 is left foot back symbol paceFR =paceC-20 'Right foot forward symbol paceFL =paceC+20 'Left foot forward symbol paceFRmax =100 'Right foot forward symbol paceFLmax =190 'Left foot forward symbol sframe =20 'time between servo pulses symbol pacespeed =b7 '6 is about max for servos to keep up pacespeed =4 '6 is about max for servos to keep up initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub Rt gosub Rt gosub Rt gosub Rt toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub Lt gosub Lt gosub Lt gosub Lt goto start Fd: sertxd (" Fd") if paceat<paceC then _FdL 'else _FdR _FdR: 'sertxd ("_FdR") gosub _rollL gosub _RF gosub Stand return _FdL: 'sertxd ("_FdL") gosub _rollR gosub _LF gosub Stand return Rt: if paceat<paceC then gosub Fd 'need left foot forward gosub _RF return Lt: if paceat>paceC then gosub Fd 'need right foot forward gosub _LF return _RF: 'sertxd ("_RF") for spulse=paceat to paceFR step -pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return _LF: 'sertxd ("_LF") for spulse=paceat to paceFL step pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return Stand: 'stand with both feet flat sertxd (" Sd") if rollat<rollC then _StandR 'else _StandL _StandL: 'sertxd ("_SL") for spulse=rollat to rollC step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _StandR: 'sertxd ("_SR") for spulse=rollat to rollC step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollL: 'sertxd ("_rL") for spulse=rollat to rollL step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollR: 'sertxd ("_rR") for spulse=rollat to rollR step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _iStand: 'initialise with feet in mid position for spulse=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next spulse rollat =rollC paceat =paceC return
'Bambino-15a 'Bambino-15a Sertxd("B15a",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Bambino-11 'Investigate effect of rollspeed; watch roll for all three speeds 'Bambino-12 'Investigate effect of rollspeed; watch Roll and Stand for all three speeds 'Bambino-13 'Check paceFL paceFR; Investigate effect of pacespeed 'Bambino-14 'Check Fd 'Bambino-15 'Test Rt, Lt 'Bambino-15a 'Test T2L Turn to Light, T2D Turn to Dark 'Test T2L Turn to Light, T2D Turn to Dark '---------------------------------------- 'modified '-------- 'start: 'New '--- 'T2L 'T2D symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed_ =c.5 symbol eyeLedL_ =c.2 symbol eyeLedR_ =b.1 symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol eyeR =c.7 symbol eyeL =c.1 symbol spulse =b2 'symbol i =b3 symbol rollat =b4 symbol paceat =b5 symbol rollC =150 '100 is roll to the left symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =b6 '4 is too fast, 0 won't move rollspeed =1 '4 is too fast, 0 won't move symbol paceC =150 '100 is left foot back symbol paceFR =paceC-20 'Right foot forward symbol paceFL =paceC+20 'Left foot forward symbol paceFRmax =100 'Right foot forward symbol paceFLmax =190 'Left foot forward symbol sframe =20 'time between servo pulses symbol pacespeed =b7 '6 is about max for servos to keep up pacespeed =4 '6 is about max for servos to keep up initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub Rt gosub Rt gosub Rt gosub Rt toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub Lt gosub Lt gosub Lt gosub Lt goto start T2L: Fd: sertxd (" Fd") if paceat<paceC then _FdL 'else _FdR _FdR: 'sertxd ("_FdR") gosub _rollL gosub _RF gosub Stand return _FdL: 'sertxd ("_FdL") gosub _rollR gosub _LF gosub Stand return Rt: if paceat<paceC then gosub Fd 'need left foot forward gosub _RF return Lt: if paceat>paceC then gosub Fd 'need right foot forward gosub _LF return _RF: 'sertxd ("_RF") for spulse=paceat to paceFR step -pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return _LF: 'sertxd ("_LF") for spulse=paceat to paceFL step pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return Stand: 'stand with both feet flat sertxd (" Sd") if rollat<rollC then _StandR 'else _StandL _StandL: 'sertxd ("_SL") for spulse=rollat to rollC step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _StandR: 'sertxd ("_SR") for spulse=rollat to rollC step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollL: 'sertxd ("_rL") for spulse=rollat to rollL step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollR: 'sertxd ("_rR") for spulse=rollat to rollR step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _iStand: 'initialise with feet in mid position for spulse=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next spulse rollat =rollC paceat =paceC return
'Bambino-16 '>Bambino-16 '>Robot R-Bambino Sertxd("B16",cr) 'report program number #PicAxe 20M2 #no_data 'Bambino-01 'Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 'Test InfraRed input 'Bambino-02a 'Test Eye light values 'Bambino-02b 'Test Whisker light values and put in EEPROM 'Bambino-03 'Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-04 'Set servos to mid position 'Bambino-05 'Calibrate servo mid positions and put in EEPROM. 'Bambino-06 'Introduce _iStand:- initialise with feet in mid position 'Bambino-07 'Set rollR 'Bambino-08 'Set rollL 'Bambino-09 'Check rollR, rollL 'Bambino-10 'Introduction of _Stand 'Bambino-11 'Investigate effect of rollspeed; watch roll for all three speeds 'Bambino-12 'Investigate effect of rollspeed; watch Roll and Stand for all three speeds 'Bambino-13 'Check paceFL paceFR; Investigate effect of pacespeed 'Bambino-14 'Check Fd 'Bambino-15 'Test Rt, Lt 'Bambino-15a 'Test T2L Turn to Light, T2D Turn to Dark 'Bambino-16 'Test Bk 'Test Bk '-------- 'modified '-------- 'start: 'New '--- 'Bk '_BkR '_BkL symbol servopace =c.0 'left connector symbol servoroll =c.4 'right connector symbol VoiceLed =c.5 'low =>LED on symbol eyeLedL_ =c.2 'low =>LED on symbol eyeLedR_ =b.1 'low =>LED on symbol whiskerLedL_ =c.3 'low =>whisker LED on symbol whiskerLedR_ =b.3 'low =>whisker LED on symbol iIRin =c.6 symbol oIRout =b.2 symbol spulse =b2 'symbol i =b3 symbol rollat =b4 symbol paceat =b5 symbol rollC =150 '100 is roll to the left symbol rollR =rollC+15 symbol rollL =rollC-15 symbol rollspeed =b6 '4 is too fast, 0 won't move rollspeed =2 '4 is too fast, 0 won't move symbol paceC =150 '100 is left foot back symbol paceFR =paceC-20 'Right foot forward symbol paceFL =paceC+20 'Left foot forward symbol paceFRmax =100 'Right foot forward symbol paceFLmax =190 'Left foot forward symbol sframe =20 'time between servo pulses symbol pacespeed =b7 '6 is about max for servos to keep up pacespeed =2 '6 is about max for servos to keep up initialise: low eyeLedR_ 'make output high eyeLedL_ 'make output gosub _iStand start: toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub Fd gosub Fd gosub Fd gosub Fd toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running gosub Bk gosub Bk gosub Bk gosub Bk toggle eyeLedR_ 'alter eyeR so we know program is running toggle eyeLedL_ 'alter eyeR so we know program is running goto start Fd: sertxd (" Fd") if paceat<paceC then _FdL 'else _FdL _FdR: 'sertxd ("_FdR") gosub _rollL gosub _RF gosub Stand return _FdL: 'sertxd ("_FdL") gosub _rollR gosub _LF gosub Stand return Bk: sertxd (" Bk") if paceat<paceC then _BkR 'else _BkL _BkL: gosub _rollR gosub _RF gosub Stand return _BkR: gosub _rollL gosub _LF gosub Stand return Rt: if paceat<paceC then gosub Fd 'need left foot forward gosub _RF return Lt: if paceat>paceC then gosub Fd 'need right foot forward gosub _LF return _RF: 'sertxd ("_RF") for spulse=paceat to paceFR step -pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return _LF: 'sertxd ("_LF") for spulse=paceat to paceFL step pacespeed paceat =spulse pulsout servopace,paceat 'pulse servo pulsout servoroll,rollat 'pulse servo hold in position pause sframe next spulse return Stand: 'stand with both feet flat sertxd (" Sd") if rollat<rollC then _StandR 'else _StandL _StandL: 'sertxd ("_SL") for spulse=rollat to rollC step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _StandR: 'sertxd ("_SR") for spulse=rollat to rollC step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollL: 'sertxd ("_rL") for spulse=rollat to rollL step -rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _rollR: 'sertxd ("_rR") for spulse=rollat to rollR step rollspeed rollat =spulse pulsout servoroll,rollat 'pulse servo pulsout servopace,paceat 'pulse servo hold in position pause sframe next spulse return _iStand: 'initialise with feet in mid position for spulse=0 to 10 pulsout servopace,paceC 'pulse servo paceC pulsout servoroll,rollC 'pulse servo rollC pause 70 'pause 70ms - do it slowly next spulse rollat =rollC paceat =paceC return