'Bambino-28 SERTXD("B28",CR) 'report program number @4800baud '112 bytes #PicAxe 20M2 #no_data '================================================================= 'PICAXE IC Memory ext I/O Outputs Inputs ADC Memory Starts Polled Resonator ' £ Type pins bytes slot pins Vars. RAM Spad Data Table* Int. def. opt. '2.28 PICAXE-20M2 20 2k 18 1-16 1-17 4 28 512 256 512 8 Yes 4 -32 'PICAXE-20M2 circuit board with LEDs off takes 1mA 'PICAXE-20M2 circuit board with LEDs off and servos connected takes 10mA '================================================================= 'Bambino-01 Test eyeLEDs, whiskerLEDs and speaker 'Bambino-02 Test PWM of eyeLEDs 'Bambino-03 Test InfraRed input 'Bambino-04 Test Eye light values 'Bambino-05 Test Whisker light values 'Bambino-06 Play the inbuilt tunes using keys 1 to 4 and beep on 5 'Bambino-07 Set servos to mid position 'Bambino-08 Calibrate servo mid positions and put in EEPROM. 'Bambino-08+ Adjust servo mid positions from Handset and put in EEPROM. 'Bambino-09 Introduce _iStand:- initialise with feet in mid position 'Bambino-10 Set rollby, rollbymax for Roll Right 'Bambino-11 Check rollby, rollbymax for Roll Left 'Bambino-12 Check rollby and rollbymax for rollL, rollR 'Bambino-13 Introduction of _Stand 'Bambino-14 Investigate effect of rollspeed; ' watch roll for all three speeds 'Bambino-15 Investigate effect of rollspeed; ' watch Roll and Stand for all three speeds 'Bambino-16 Check paceFL paceFR; Investigate effect of pacespeed ' Introduction of pulseservos: 'Bambino-17 Check Fd 'Bambino-18 Test Rt, Lt 'Bambino-19 Test Bk 'Bambino-20 Test T2l: TurntoLight: T2d: TurntoDark: Wl: Wd: 'Bambino-21 Creation of sections ACTIONS, BEHAVIOURS, ACTS; ' Introduction of ACT parameter 'Ado' 'Bambino-22 Demo routine + example use of Start1: to flash eyes 'Bambino-23 Walk Fd with obstacles avoidance using eyes from 04, ' introduction of Default behaviour 'Bambino-24 Walk Fd with obstacles avoidance as 23, with Act BT 'Bambino-25 Walk Fd with drop-off avoidance using whiskers from 05 'Bambino-26 rewritten with reading of whiskers as subroutines 'Bambino-27 rewritten with autocalibration of down whiskers 'Bambino-28 Test maximum PWM and hence minimum brightness of eyeLEDs, ' needed in Bambino-29 '----------------------------------------------------------------- Rationale: 'To alter the brightness of the eyeLEDs we need to use PWM 'Here I test PWM settings and the only way to do that is to run the 'program and see what is the efect on the LEDs. 'in Bambino-02 the code PWM'd the Eye LEDs, 'first the Right eye at 10KHz then the Left Eye at ~40kHz 'first the Right eye at 10KHz then the Left Eye at ~4kHz 'Remember when the pin is HIGH the LED is off 'and when the pin is LOW the LED is fully on 'The minimum brightness is going to be at 'the maximum duty cycle without being fully on, ie the LED being OFF. 'If the period is 24 then the maximum duty cycle is only 99 out of 100. 'But if the period is 255 then the maximum duty cycle is 1023 out of 1024. 'Here is added a last dim state of 255,1023 'and it can be seen to be dimmer than any of the other dimmest states. '================================================================= 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 t =200 'pause time SYMBOL period =B1 '255 '99 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: '-------------------------------------------------- HIGH VoiceLed_ 'LED off 'period =99 'at 4mHz => (99+1)*4 =400 uS 'so max duty count =400 PWMOUT eyeLedR_,99,399 'dimmer +3 PAUSE t PWMOUT eyeLedR_,255,1023 'dimmest PAUSE t ' PWMOUT eyeLedR_,99,400 'off PWMOUT eyeLedR_,off PAUSE 500 'period =24 ' => max duty cycle count =(24+1)*4 =100 'so max duty count =100 PWMOUT eyeLedL_,24,99 'dimmer +1 PAUSE t PWMOUT eyeLedL_,255,1023 'dimmest PAUSE t ' PWMOUT eyeLedL_,24,100 'off PWMOUT eyeLedL_,off PAUSE 500 '-------------------------------------------------- LOW VoiceLed_ 'LED on 'period =99 'at 4mHz => (99+1)*4 =400 uS 'so max duty count =400 PWMOUT eyeLedR_,99,399 'dimmer +3 PAUSE t PWMOUT eyeLedR_,255,1023 'dimmest PAUSE t ' PWMOUT eyeLedR_,99,400 'off PWMOUT eyeLedR_,off PAUSE 500 'period =255 ' => max duty cycle count =(255+1)*4 =1024 'so max duty count =1024 but can't do 1024 as parameter max is 1023 so 1024=0 PWMOUT eyeLedL_,255,1023 'dimmest +4 PAUSE t PWMOUT eyeLedL_,255,1023 'dimmest +4 PAUSE t PWMOUT eyeLedL_,off 'can't do 1024 as parameter max is 1023 so 1024=0 PAUSE 500 GOTO start '=================================================================