27.01.2015 Views

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Step 4<br />

Determine the lamp patterns that will be required for norma<br />

traffic light operation. How many are used What are they How ca<br />

they be stored in the computer<br />

There are only four patterns. They are (a) red on Elm, green o<br />

Main ( 222) , ( b) red on Elm, yellow on Main ( 238) , ( c ) green on<br />

Elm, red on Main ( 243) , and ( d) yellow on Elm, red on Main ( 245).<br />

The values could be stored through the use of DAT A statements,<br />

subscripted variables, or just as variables, one per lamp pattern.<br />

Step 5<br />

In the remainder of this experiment, we will assume a "yellow<br />

period" of two seconds. Thus, if Elm Street is on a 10-second period,<br />

the green light will be on for 10 seconds, followed by a 2-second<br />

yellow, before the signal goes to red.<br />

Write a program that will allow you to sequence through the.<br />

light patterns, with a 6-second period on Elm and a 10-second period<br />

on Main Street.<br />

We used the following program:<br />

10 M = 10: E = 6: P = 49318<br />

20 DAT A 222, 238, 243, 245<br />

30 READ L<br />

40 POKE P,L<br />

50 FO R R = l TO M<br />

138

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!