25 May 2017 @06Sep23 ------------------------------------ Zero2 ----- Just as with a washing machine controller where you wouldn't expect to have to write more microcontroller code just to get it to do a different wash cycle so neither is it desirable to have to continually write Arduino code to change what the robot does. The following commands can be entered from the Serial Monitor (or other Terminal) set to 9600 baud and sequences of commands can be recorded in the EEPROM so they are remembered even when power is off. The sequences of commands can then be replayed. If each sequence which we will call an Act takes less than 32 commands then 8 Acts will fit in the second 256 byte page of the EEPROM. A second set of eight Acts will fit in the first 256 byte page of the EEPROM. These are addressed as logical Page0 by prefixing with 0 the 1-8 Act number. So sixteen Acts can be remembered. 01,02,03,04,05,06,07,08,1,2,3,4,5,6,7,8 An Act can have up to 31 commands followed by '.' indicating end of the Act. Any Act can chain to another Act, even itself. Any of the Acts 1 - 8 can be set to autorun on poweron or reset, depending on selected behaviour. ------------------------------------ Primary commands used 012345678 ?#.()* BFLR bcfhilrsw > - ready prompt COMMANDS ======== [Esc],[Q] - stop, quit operations, Horn off, LEDs off, go to command mode [.] - stop, end current operation - recording, playing, input [(] - start of a Do, will show its location in EEPROM when played, eg (=263 If a jump to another Act is made from within a Do then the location to return to will be shown, eg (267) A jump to an Act from a Do will on . continue in the Do If a jump is made to an Act which contains another Do then that Do will become the current Do. Do are nestable up to 15 deep. [)] - end of Do, will show its location in EEPROM when played, eg )=285 [0] - use page0 for the next cmnd or Act number [1-8] Play act, or the Act to record, copy, load etc [p][1] - 9v power always on, autoPower off [p][0] - 9v power off, AutoPower off [F]{digits}[,] - Forwards - if no digits then 1 - units mm [B]{digits}[,] - Backwards - if no digits then 1 - units mm [R]{digits}[,] - turn Right - if no digits then 1 - units degrees [L]{digits}[,] - turn Left - if no digits then 1 - units degrees [D] - Pen down [U] - Pen up [P] - initialise Pen [f][l]{digits}[,] - forward left - if no digits then 1 - units 1/2 degree [f][r]{digits}[,] - forward right - if no digits then 1 - units 1/2 degree [b][l]{digits}[,] - backward left - if no digits then 1 - units 1/2 degree [b][r]{digits}[,] - backward right - if no digits then 1 - units 1/2 degree [m][digits][,] - actual degrees for 360 degrees [w][0-9,0] - wait seconds, 0=10 [n][0-9,0] - nap tenths second, 0=10 [E] - Experiment, do user code SPEED [s][1-9] - steptimeC - steptime=2*steptimeC " [+] - speed-up, steptimeC -=1 >=1 " [-] - speed-down, steptimeC +=1 " [u] - speed-up, steptimeC -=1 >=stepmin " [d] - speed-down, steptimeC *=2 " [m] - set speed-max for speed-up to current speed " [s] - save speed INDICATORS [i][o] - Indicators off " [r] - Indicator R on " [l] - Indicator L on " [s] - Indicators on [i][0] - Indicators off " [1] - Indicator R on " [2] - Indicator L on " [3] - Indicators on HORN [h][o] - horn off " [h] - horn high tone " [l] - horn low tone " [n] - horn (both tones) [h][0] - horn off " [1] - horn low " [2] - horn high " [3] - horns on GRIPPER [g][0-3] - Address1 D3,D2 control on P1 (aux gripper) SENSORS [$][l] - return line status [$][L] - return line status - because lowercase L looks like 1 Future use - [$][f] - return feeler status Future use - [$][g] - return ground status BEHAVIOUR uses # because 'b' already used for 'b'ackward [#][0] - reload behaviour " [S] - Save current behaviour " [a] - set AutoAct 1-8, 0 no autoact " [m] - set defaultMove " [t] - set defaultTurn " [s] - set stepScale500, steps for 500mm " [r] - set rotateScale360, steps for 360deg " [v] - set verbose printing on " [q] - quiet, set to quiet printing " [#] - do[Q] same as Bamduino SYSTEM [r][0 1-8] - record act, 0 use page0 [l][0 1-8] - load act, 0 use page0 [c][0 1-8][0 1-8] - copy Act to Act, 0 use page0 [Z][digits][,] - send a byte to robot [S][digits][,] - sound 76489 [T][digits][,] - talk say phoneme, SP0256 [*][d] - toggle debug mode [*][f][9] - setZbaud to 9600 [*][f][4] - setZbaud to 4800 - default SHOW [?][?] - print acts " [a] - '??' prints all acts " [0] - prints acts 0, and changes '??' to just print current page - (for QL zero2 program) " [b] - print behaviour - thisprog, - autoAct, - f_runDefault, - steptime, - stepmin, - stepScale360 " [d] - dump all acts to PC without descriptions, suitable for loading " [h] - print help IR-COMMANDS keyPOWER: Ccmnd ='.'; keyUP: Ccmnd ='F'; keyDOWN: Ccmnd ='B'; keyRIGHT: Ccmnd ='R'; //to do - if(f_hashcmnd) { Ccmnd ='>'; } break;//else {go_turnRight(); } break; // [>] keyLEFT: Ccmnd ='L'; //to do - if(f_hashcmnd) { Ccmnd ='<'; } break;//else { go_turnLeft(); } break; // [<] keyBAR: Ccmnd ='r'; //to do - f_IRrecord =1; break; // [f|] //so we can set autoAct if recording Act8 keyTENT: Ccmnd ='a'; // [f^] keyVCROSS: Ccmnd ='?'; // [f+] keyXCROSS: Ccmnd ='#'; // [fx] key0: Ccmnd ='0'; key1: Ccmnd ='1'; key2: Ccmnd ='2'; key3: Ccmnd ='3'; key4: Ccmnd ='4'; key5: Ccmnd ='5'; key6: Ccmnd ='6'; key7: Ccmnd ='7'; key8: Ccmnd ='8'; key9: Ccmnd ='9'; keyMINUS: Ccmnd ='-'; keyPLUS: Ccmnd ='+'; Notes ----- {digits} is an optional string of digits, must be ended with comma, space or next command letter. [(] - will show its location in EEPROM when played eg (=263 [)] - will show its location in EEPROM when played eg )=285 If a call to another Act is made from within a Do then the location to return to will be shown, eg (267) Acts by default are stored in page 1, 0 changes to page 0 for the next command only. Page 0 ia EEPROM bytes 0-255, Page 1 is EEPROM bytes 256-511 etc. If other keys are pressed, including lower case keys, then the Whisker LEDs will flash badkey(). Upper-case is used for single letter commands and Lower-case will be used for parameter commands. Until programming mode is entered any of the commands have immediate effect. In immediate mode keys 1 - 8 will play the corresponding Act, whatever has been recorded. If 'r' is entered then the next key must be 1 - 8 to select the Act to be recorded. If '.' is entered instead then recording will not start. Any of the keys can be entered in recording mode including 'r' but that makes no sense and is blocked during recording by setting f_recordC to false. '?' operates but is also blocked from being recorded by setting f_recordC to false. When recording has started keys (0) 1 - 8 will record a jump to the corresponding Act. However in record mode playback of that Act is suppressed, hence after entering an Act number it makes no sense to add more commands since they will never be done because control will jump to the new Act; so just enter '.' to quit recording. E.g. "r1FFRR1." records "FFRR1." in Act1 if in immediate mode '1' is entered then Act-1 will be played giving Forward, Forward, turnRight, turnRight, jump to Act 1 So Act 1 will play forever, Act 1 could also be invoked from another Act eg "r21." here Act 2 does nothing except jump to Act-1. '.' or Esc quits a playing Act. The command 'l','1'-'8' - loads an Act directly from the Serial Monitor without acting E.g. "l7VVVFFV." loads Act-7 with "VVVFFV." You can load command strings which either won't Play or do odd things, so beware. E.g. keys l7?bVV. will load "?bVV." into Act-7, but after '?b' the "VV" will never be done. E.g. "l7VV?2VV." will load "VV?2VV." into Act-7 and when played Bambino plays VV then does '?' which expects an Act number for the Act to print, when the Act is printed the EEPROMindex will point to the end of the printed Act so Play will end. However if '.' is entered instead of an Act number then the '7' after '?' will be read and Act-7 will be done again. ============================================================= Updates ------- 2020-07-01 added - Any Act can chain to another Act, even itself. 2020-07-01 corrected - Page 0 ia EEPROM bytes 0-255 -> Page 0 is EEPROM bytes 0-255 =============================================================