View Single Post
Old 8th Feb 2019, 8:29 am   #7
julie_m
Dekatron
 
Join Date: May 2008
Location: Derby, UK.
Posts: 7,735
Default Re: Lego tape recorder

I had a lot of Lego as a kid; including some Technic kits and both 4.5V and later 12V railways.

Probably the most interesting thing I built with Lego and "other things" was a little robot which used two of the 4.5V Lego motors and a control unit with three relays wired up to the user port of my BBC Model B. The computer allowed start/stop of both motors together and reversing of each motor individually, so it could perform halfpenny turns by running one side forwards and the other side backwards.

I wrote a program which just had some DEFPROCs to abstract away all the ugly memory statements for the I/O port routines (setting up the control register to have right pins as outputs and turning them all OFF;setting the correct outputs for each direction of movement, waiting for a specified time period and then back OFF) at high line numbers, and SAVEd it like that. Then I could easily just add a few lines like
Code:
100 PROCsetup: REM initialise user port
110 FOR A%=1 TO 4
120 PROCfwd(200): REM forwards
130 PROCcw(50): REM turn clockwise
140 NEXT A%
150 FOR A%=1 TO 4
160 PROCacw(50): REM turn anticlockwise
170 PROCrev(200): REM go backwards
180 NEXT A%
190 GOTO 110
to make a complete program to do stuff (even writing additional PROCs for complex sequences of moves).

But by this time I was a teenager. And somehow, money issues always got in the way of adding the originally-planned extra relays and sensors; there always seemed to be other, more important stuff to buy.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments.
julie_m is offline