rss14
|
Posted: Wed Jun 04, 2008 5:02 pm Post subject: Help with parallelget and traffic lights assignment |
|
|
I need to make a project about a traffic intersection. So i need to write a code, which turns on pins on a parallel port, so that my LEDs turn on, as they would in real life.
The wires are inside a cable, which has 8 wires in total
2 reds are connected to pin 2 (1), 2 opposite reds are connected to pin 3 (2), 2 yellows are connected to pin 4 (4), opposite yellows are connected to pin 5 (8), 2 greens are connected to pin 6 (16), and opposite greens are connected to pin 7 (32)
Pin 19 is ground. I have an extra wire, which i haven't attached to the parallel port yet.
loop
parallelput (33) % Red, Red, Green, Green
delay (5000)
parallelput (9) % Red, Red, Yellow, Yellow
delay (2000)
parallelput (18) % Green, Green, Red, Red
delay (5000)
parallelput (6) % Green, Green, Red, Red
delay (2000)
end loop
I need to modify this code, so I can incorporate a button, and another LED, for a crossing light. I am thinking of connecting the extra wire to pin 11, so I can use parallelget to know when the button has been pressed. Then i will keep that in a variable, until the light can go on. . .
So basically, i need to know how to write parallelget . . . Any other help will be appreciated. Thanks. |
|
|