Home | News | Products | Support | Download | Sales | library | Guests | Contact | WebCam | Links
CDS Logo LanBox-Talk mail archive
 

By date: Prev | Next | Index By thread: Prev | Next | Index

SubjectRe: [LCtalk] Forth
FromMatthijs van Duin
DateSat, 26 Feb 2005 14:12:41 +0100


On Sat, Feb 26, 2005 at 09:58:53AM +0100, Joost Rekveld wrote:
this is SO cool..

i've scanned the fullhelp txt rather quickly, and also this is at the moment a purely theoretical question for me since I currently own two LCE's (so without analog inputs), but I guess it should be possible to write stuff that monitors the analog input signals ?

Yes. It appears to be missing from the help, but there's a command:

GetInput  ( inputnr -- value ) \ read an io value from the io table


I've peen pondering on the possibillity to write my own code to have an LCX listen to sensors and run an interactive light-installation all by itself. So far I've been using a laptop with an interface for analog input for this, but I guess I could do away with those and run everything from an LCX instead, no ?
(if I can keep my code concise enough, that is...)

Yep. You can use 'PreMixTick and issue commands (basically the same ones LCedit has) before the sequence and mixer act on them, or use the 'PostMixTick hook and directly write generated data into the mixer, bypassing the usual sequence-mix run for those. For example:


   : analog-to-mixer ( -- )
	1 GetInput         \ -- val )  read analog input 1
	2/ 2/              \ -- val )  scale from 10-bit to 8-bit
	MixerOut 1+ C!     \ -- )  store into mixer channel 1
   ;

   ' analog-to-mixer  TO 'PostMixTick


I would have to seriously brush off my forth, though, haven't used it since I stopped using my atari mega ST...

:-)

This seems to be a nice book:  http://orangetide.com/forth/Handbook.pdf

Not all of it applies to our Forth system of course, but a lot does.

--
Matthijs van Duin  --  May the Forth be with you!


By date: Prev | Next | Index By thread: Prev | Next | Index