[Coco] Example basic code for screen grid

Darren A mechacoco at gmail.com
Sat Feb 25 13:33:50 EST 2012


>
> I want to thank everyone for their help with this.
> After lots of different things I have tried, it turns out the above method is best for my needs.
> I used set commands to generate a good size dot  and some for next loops to make the dot flash on and off.
> I tested this with my photocell sensors by attaching it (duct tape works wonders) to that area of the screen.
> Motors, relays, lights,whatever I want will turn on and off, controlled by the coco.
> 5 cls0
> 10 set (0,5,5)
> 15  set (0,6,5)
> 20 set (1,5,5)
> 25 set (1,6,5)
> 30 for x = 1 to 300
> 40 next x
> 50 cls0
> 60 for x = 1 to 1000
> 70 next x
> 80 goto 5
> Much more work to do but this is proof of concept. THANKS GUYS!
> Can't tell you how happy I am this works or will work. I have alot more work to do on this, but just knowing the idea will work
> makes me feel fantastic! Coco home automation and a coco powered mobile robot here I come...
>
---

Here is an example that generates a random byte value (0-255) and
displays the bit pattern on a black screen (lsb first). The white
blocks represent the '1' bits.

10 CLS 0
20 W$=CHR$(128)+CHR$(207)+CHR$(202)+CHR$(128)
30 B$=STRING$(4,128)
40 D=RND(255)
50 PRINT at 96,"";
60 FOR M=1 TO 256 STEP 0
70 IF D AND M THEN PRINT W$; ELSE PRINT B$;
80 M=M+M:NEXT
90 FOR T=0 TO 200:NEXT
100 GOTO 40

Darren



More information about the Coco mailing list