VARIABLES clock () MovToObject(obj) RA Step (direction, steps) Sits in background and calls program to execute regularly Adds the relevant number of steps to the RA and DEC variables Sends the correct o/p to the GPIO to step the stepper motor in specified direction Observation() spiralSearch() DEC Step (direction, steps) Runs sequence for set period of time Searches for signal using a spiral pattern Sends the correct o/p to the GPIO to step the stepper motor in specified direction clockDrive() Keypad() Uses an interrupt to increment the RA VAR by the number of steps that need to be stepped in RA Uses an interrupt to read buttons presses on a direction keypad Measure() PMT() Calls all the subroutines to move scope between objects and make the measurements Returns value of photo multiplier tube Save() PMTcontrol() Saves the data to disk Turns on and off the PMT, clears the values etc. Once moved to a star location the checkObject sub routine checks the star is there and if not triggers the spiral search, if this fails the checkObject sub will set a timer that counts down to zero – this pauses all but the RA clock drive. CheckObject () RTCread() Once on a star the PMT control start the measurement, and this is read into the aRESULTS array and then saved to non-volatile memory. Compares measured with sky to see if cloudy and if so sets a variable with a value that decrements Reads the real time clock and returns time and other data stored LCDwrite () Setup() RTCwrite() Write data to LCD Runs sequence to set-up observing session Writes the real time clock and returns time and other data stored iRA holds the number of steps to step in RA iDEC holds the number of steps to step in DEC aOBJECTS((4,3) array that holds relative RA/DFEC and name for the 4 objects (VAR, COMP, CHK, SKY) aRESULTS(~,4) holds the results for each measurement for each object iCLOUD is a counter that is set to a figure and decrements when loud is discovered, when it reaches zero a spiral search is initiated to look for the star The main program is executed by clock() interrupt (this is probably less processor hungry than mindlessly looping). The main sub routine (measure()) checks if there is a positive or negative value in RA or DEC variables and if so steps the RA and DEC motors appropriately, incrementing or decrementing these variables accordingly with each step. Another interrupt increments the RA variable periodically to provide an RA drive feed. To move to an object the main sub calls moveToObject this adds the relative number of steps to the RA and DEC variable and so triggers movement to the object, all the time the clockDrive interrupt is continuing to increment the RA variable at a rate to drive at sidereal rate. function Sub-routine interrupt Other considerations • I have no idea of how fast the APT can slew, but we could think about having an observing list that the telescope could work through