25 May 2017 @01 Jul 2020 ------------------------------------ Zeaker2 and 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 *Zero2 only ======== [Esc],[Q] - stop, quit operations, go to command mode [.] - stop, end current operation - recording, playing, input [(] - start of Mind, will show its location in EEPROM when played, eg (=263 If a jump to another Act is made from within Mind then the location to return to will be shown, eg (267) A jump to an Act from Mind will on . continue in Mind If a jump is made to an Act which contains another Mind then that Mind will become the current Mind and the old Mind will not be returned to [)] - end of Mind, will show its location in EEPROM when played, eg )=285 [0] - use page0 for the next cmnd or Act number [a][1-8] - Act to autorun on power on [a][0] - no autorun [1-8] Play act, or the Act to record, copy, load etc *[V] - turn on 9v power, set autoPower off *[p][1] - 9v power always on, autoPower off *[p][0] - autoPower, automatically disconnect 9v when stopped [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 [s][1-9] - steptime/2 " [+] - speed-up, steptime -=1 >=1 " [-] - speed-down, steptime +=1 " [u] - speed-up, steptime -=1 >=stepmin " [d] - speed-down, steptime *=2 " [m] - set speed-max for speed-up to current speed " [s] - save speed [i][o] - Indicators off " [r] - Indicator R on " [l] - Indicator L on [i][0] - Indicators off " [1] - Indicator R on " [2] - Indicator L on " [3] - Indicators on [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 *[Z][digits][,] - send a byte to robot *[S][digits][,] - sound 76489 *[T][digits][,] - talk say phoneme, SP0256 *[$][l] - return line status [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 [?][?] - 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 Future use - [$][f] - return feeler status Future use - [$][g] - return ground status Notes ----- {digits} is an optional string of digits, must be ended with comma, space or next command letter. [(] - will show its location in EEPRO< when played eg (=263 [)] - will show its location in EEPRO< when played eg )=285 If a call to another Act is made from within Mind 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 =============================================================