Shop OBEX P1 Docs P2 Docs Learn Events
Traffic lights sequencer — Parallax Forums

Traffic lights sequencer

chilangishachilangisha Posts: 1
edited 2011-07-26 12:06 in BASIC Stamp
Can some one help me with code and connections for implementing a traffic light sequencer. I have 10 LED's each orange, green, and red. The last time I worked with a basic stamp was almost 6 years ago and my head is rusty. I need to present this project at the show.

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2011-07-26 12:06
    Well, thankfully, the stamp hasn't changed much in the last few years so your previous experience should count,

    Without knowing any details of what you have planned for a demo, you could get started by assigning a pin for each of the leds (using current limiting resistors, of course.).

    Say its a standard intersection, laid out with one road east - west and one road north- south. You'd assign a pin to red-east, red-west, yel-east, yel-west, green-east, green-west and so on.

    Then, figure out which leds will be on at any one time. For example, green-east, green-west, red-north, red-south would be on together. Continue figuring out the situation for all other possibilities.

    Your code just steps through the combinations with appropriate pauses in between. Then repeats.

    Show us what you've got and I'm sure someone will provide more help.

    Cheers,
Sign In or Register to comment.