[Coco] Example basic code for screen grid

haywire666 at aol.com haywire666 at aol.com
Sat Feb 25 00:29:42 EST 2012


Andrew,


For my purposes, I don't need user input. I could run a seperate program like this would some of the squares white and some black at different times,
or on a timed loop to turn things on/off. At least I think that will work, but for testing user input would be great. (maybe the bottom line of the screen could be input instead of the grid?)

My first step is getting the grid working and knowing how to turn the blocks black or white, then I'm pretty sure I could figure out the rest. (I hope!)


Essentially white block - line on black block line off. Each square on the screen would have a corresponding photocell or phototransister in front of it.


This is a very crude way of getting control lines out of a coco, but with my limited electronics skills, I think this method would be best for me.
If I could get an 8x8 grid with 8x8 squares, I could essentially have 64 lines of output control from the coco (after connected 64 identical on/off photocell or phototransister circuits.)


May take me quite awhile to build that many circuits but one thing I know is that if it works great once, you can duplicate the results.


I have tested a couple of circuits just attaching one to the screen and using cls0 and cls5 and it this method can indeed to work to control anything... motors, relays, lights, and so on.


I suppose the trick will be getting the grid to turn on or off the blocks in some way. User input for testing would be nice... Maybe just enterting 1-64 and that would turn each on on or if you entered
say 1 it would change to the other state, if you know what I mean, like if the square was white and you entered the # for that square it turned black...


Thanks so much for your help, I'm kinda lost on basic, just took out my cocos for the first time in years recently.

Best regards,


Steven






-----Original Message-----
From: Andrew <keeper63 at cox.net>
To: coco <coco at maltedmedia.com>
Sent: Fri, Feb 24, 2012 11:59 pm
Subject: Re: [Coco] Example basic code for screen grid


> Message: 1
> Date: Thu, 23 Feb 2012 23:38:52 -0500 (EST)
> From: haywire666 at aol.com
> Subject: Re: [Coco] Example basic code for screen grid
> To: coco at maltedmedia.com
> Message-ID:<8CEC0C5580EBAED-1118-76583 at Webmail-d107.sysops.aol.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Andrew, yes it works. Thats almost exactly what I need but I need no white 
outline around the grid and
> I need about 1/4 of the squares as you have here. Like it needs to be about 
1/4 of the squares and bigger.

Try this for fewer squares (I just modified the step rate to be 4 times 
larger, so the grid s/b 8 x 6 now):

10 PMODE 4,1
20 PCLS
30 SCREEN 1,1
40 FOR Y=0 TO 191 STEP 32
50 FOR X=0 TO 255 STEP 32
60 REM LINE(X,Y)-(X+8,Y+8),PSET,BF: REM FILLED WITH WHITE
70 REM LINE(X,Y)-(X+8,Y+8),PRESET,BF: REM FILLED WITH BLACK
80 LINE(X,Y)-(X+8,Y+8),PSET,B: REM UNFILLED (WHITE GRID)
90 NEXT X
100 NEXT Y
110 GOTO 110

> I'll play with this and see what I can do. Thanks so much thats pretty 
impressive you did that from memory!
>
> Also, Can I get this to be black bordered instead of white bordered?

By "white bordered" do you mean the "thick white" surrounding border on 
this screen? If so, I don't know off the top of my head how to do this; 
I think it is a special POKE or something - maybe someone else has an idea?

If you mean something else, let us know!

> Thanks so much for a fantastic program!

You're welcome!

> This is for an idea I have for home automation using the coco. The screen will 
be attached to a board that sits in front of
> the monitor and has photocells. To turn something on, the square on the screen 
corresponding to each photocell can be turned
> on (white) or off (black)

Hmm - are you expecting there to be user input or such on the screen? 
What controls the squares turning on/off? If you need on-screen user 
input, then the above would require a ton of extra work (you'd have to 
create a graphical font using DRAW statements, plus create a custom 
input polling routing using INKEY$ in a loop, plus some other 
modifications); not impossible, but more than just the above simple 
script...

> Any help getting this program to be black bordered and larger squares would be 
great appreciated! I think 64 squares total on
> the screen would be all I can get with the size or average small photocells. I 
really want to get this to work I'm sure I can build all the
> photocell circuits but the software side, I've been away from coco too long!

Let us know what you mean exactly (re: my questions above), and I am 
sure something can be figured out... :)

Andrew L. Ayers
Glendale, Arizona

--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco

 



More information about the Coco mailing list