<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Traffic Light Simulation using the Basic Stamp 2</title>
	<atom:link href="http://www.tyronedavisjr.com/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tyronedavisjr.com/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/</link>
	<description>HTML &#124; CSS &#124; JavaScript &#124; ASP.NET &#124; PHP &#124; C# &#124; Java &#124; VB.NET &#124; MS SQL &#124; MySQL &#124; Flash</description>
	<lastBuildDate>Thu, 14 Jul 2011 16:27:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: vee</title>
		<link>http://www.tyronedavisjr.com/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/comment-page-1/#comment-730</link>
		<dc:creator>vee</dc:creator>
		<pubDate>Tue, 12 Jul 2011 15:34:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.tyronedavisjr.com/index.php/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/#comment-730</guid>
		<description>@bob 
nice program. I am just a beginner working with Basic stamp. Have to do a project on traffic lights. what would be the circuit for your code. just stumbled on this blog.</description>
		<content:encoded><![CDATA[<p>@bob<br />
nice program. I am just a beginner working with Basic stamp. Have to do a project on traffic lights. what would be the circuit for your code. just stumbled on this blog.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rea Orbiso</title>
		<link>http://www.tyronedavisjr.com/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/comment-page-1/#comment-604</link>
		<dc:creator>Rea Orbiso</dc:creator>
		<pubDate>Tue, 11 Jan 2011 09:10:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.tyronedavisjr.com/index.php/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/#comment-604</guid>
		<description>Traffic light Program</description>
		<content:encoded><![CDATA[<p>Traffic light Program</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Smith</title>
		<link>http://www.tyronedavisjr.com/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/comment-page-1/#comment-62</link>
		<dc:creator>Smith</dc:creator>
		<pubDate>Wed, 30 Sep 2009 09:58:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.tyronedavisjr.com/index.php/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/#comment-62</guid>
		<description>Thanks for this whole coding... it helped me a lot!</description>
		<content:encoded><![CDATA[<p>Thanks for this whole coding&#8230; it helped me a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tyrone</title>
		<link>http://www.tyronedavisjr.com/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/comment-page-1/#comment-61</link>
		<dc:creator>Tyrone</dc:creator>
		<pubDate>Wed, 08 Jul 2009 14:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.tyronedavisjr.com/index.php/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/#comment-61</guid>
		<description>@Bob

Wow. Nice work! When I get some time, I will have to plug this in when I get some time. Yes, you are right about the resistors. Thanks</description>
		<content:encoded><![CDATA[<p>@Bob</p>
<p>Wow. Nice work! When I get some time, I will have to plug this in when I get some time. Yes, you are right about the resistors. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Holden</title>
		<link>http://www.tyronedavisjr.com/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/comment-page-1/#comment-60</link>
		<dc:creator>Bob Holden</dc:creator>
		<pubDate>Wed, 08 Jul 2009 08:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.tyronedavisjr.com/index.php/2008/07/10/traffic-light-simulation-using-the-basic-stamp-2/#comment-60</guid>
		<description>Saw your video on YouTube, and thought I&#039;d improve on it a bit.

BTW, with the homework board, you don&#039;t need the resistors, just make sure that the long leads of the LED&#039;s are installed nearest the ports.

Have fun!

Try this:


&#039;{$STAMP BS2}
&#039;{$PBASIC 2.5}

&#039;Vehicle Stoplight Controller w/Pedestrian Signals
&#039;Author: Bob Holden - EAWF 7/7/2009
&#039;==================================================
&#039; Initialization

&#039; LED Setup:
&#039; North/South Signals:
&#039;  Walk Signals:
NSPG PIN 0          &#039;P0 - Green
NSPR PIN 1          &#039;P1 - Red
&#039;  Traffic Signals:
NSTG PIN 3          &#039;P3 - Green
NSTY PIN 4          &#039;P4 - Yellow
NSTR PIN 5          &#039;P5 - Red

&#039; East/West Signals:
&#039;  Walk Signals:
EWPG PIN 10         &#039;P10 - Green
EWPR PIN 11         &#039;P11 - Red
&#039;  Traffic Signals:
EWTG PIN 13         &#039;P13 - Green
EWTY PIN 14         &#039;P14 - Yellow
EWTR PIN 15         &#039;P15 - Red

second CON 1000     &#039;Length of Second in Milliseconds

x VAR Word          &#039;Counters
y VAR Word

direction VAR Word : direction = 0      &#039;current directional state

Start:
GOSUB Test
GOSUB AllRed
PAUSE 5*second

Main:
DO
 GOSUB AllRed
 PAUSE 3*second
 SELECT direction
 CASE 0
  TOGGLE NSTR
  TOGGLE NSTG
  TOGGLE NSPR
  TOGGLE NSPG
  PAUSE 10*second
  TOGGLE NSPG
  FOR x = 0 TO 18
   TOGGLE NSPR
   PAUSE second/2
  NEXT
  PAUSE second*2
  TOGGLE NSTG
  TOGGLE NSTY
  PAUSE 3*second
  direction = 1
 CASE 1
  TOGGLE EWTR
  TOGGLE EWTG
  TOGGLE EWPR
  TOGGLE EWPG
  PAUSE 10*second
  TOGGLE EWPG
  FOR x = 0 TO 18
   TOGGLE EWPR
   PAUSE second/2
  NEXT
  PAUSE second*2
  TOGGLE EWTG
  TOGGLE EWTY
  PAUSE 3*second
  direction = 0
 ENDSELECT
LOOP
END

&#039; SUBROUTINES
AllRed:
 GOSUB AllOff
 HIGH NSTR
 HIGH EWTR
 HIGH NSPR
 HIGH EWPR
 RETURN
END

Test:
 FOR y = 0 TO 3
  FOR x = 0 TO 15
   &#039; Valid Lights @ 0,1,3,4,5,10,11,13,14,15
   IF (x=2 OR x=6 OR x=7 OR x=8 OR x=9 OR x=12) THEN Skipit
   TOGGLE x
   PAUSE second/10
  Skipit:
  NEXT
 NEXT
 RETURN
END

AllOff:
 FOR x = 1 TO 15
  LOW x
 NEXT
 RETURN
END

AllOn:
 FOR x = 1 TO 15
  HIGH x
 NEXT
 RETURN
END</description>
		<content:encoded><![CDATA[<p>Saw your video on YouTube, and thought I&#8217;d improve on it a bit.</p>
<p>BTW, with the homework board, you don&#8217;t need the resistors, just make sure that the long leads of the LED&#8217;s are installed nearest the ports.</p>
<p>Have fun!</p>
<p>Try this:</p>
<p>&#8216;{$STAMP BS2}<br />
&#8216;{$PBASIC 2.5}</p>
<p>&#8216;Vehicle Stoplight Controller w/Pedestrian Signals<br />
&#8216;Author: Bob Holden &#8211; EAWF 7/7/2009<br />
&#8216;==================================================<br />
&#8216; Initialization</p>
<p>&#8216; LED Setup:<br />
&#8216; North/South Signals:<br />
&#8216;  Walk Signals:<br />
NSPG PIN 0          &#8216;P0 &#8211; Green<br />
NSPR PIN 1          &#8216;P1 &#8211; Red<br />
&#8216;  Traffic Signals:<br />
NSTG PIN 3          &#8216;P3 &#8211; Green<br />
NSTY PIN 4          &#8216;P4 &#8211; Yellow<br />
NSTR PIN 5          &#8216;P5 &#8211; Red</p>
<p>&#8216; East/West Signals:<br />
&#8216;  Walk Signals:<br />
EWPG PIN 10         &#8216;P10 &#8211; Green<br />
EWPR PIN 11         &#8216;P11 &#8211; Red<br />
&#8216;  Traffic Signals:<br />
EWTG PIN 13         &#8216;P13 &#8211; Green<br />
EWTY PIN 14         &#8216;P14 &#8211; Yellow<br />
EWTR PIN 15         &#8216;P15 &#8211; Red</p>
<p>second CON 1000     &#8216;Length of Second in Milliseconds</p>
<p>x VAR Word          &#8216;Counters<br />
y VAR Word</p>
<p>direction VAR Word : direction = 0      &#8216;current directional state</p>
<p>Start:<br />
GOSUB Test<br />
GOSUB AllRed<br />
PAUSE 5*second</p>
<p>Main:<br />
DO<br />
 GOSUB AllRed<br />
 PAUSE 3*second<br />
 SELECT direction<br />
 CASE 0<br />
  TOGGLE NSTR<br />
  TOGGLE NSTG<br />
  TOGGLE NSPR<br />
  TOGGLE NSPG<br />
  PAUSE 10*second<br />
  TOGGLE NSPG<br />
  FOR x = 0 TO 18<br />
   TOGGLE NSPR<br />
   PAUSE second/2<br />
  NEXT<br />
  PAUSE second*2<br />
  TOGGLE NSTG<br />
  TOGGLE NSTY<br />
  PAUSE 3*second<br />
  direction = 1<br />
 CASE 1<br />
  TOGGLE EWTR<br />
  TOGGLE EWTG<br />
  TOGGLE EWPR<br />
  TOGGLE EWPG<br />
  PAUSE 10*second<br />
  TOGGLE EWPG<br />
  FOR x = 0 TO 18<br />
   TOGGLE EWPR<br />
   PAUSE second/2<br />
  NEXT<br />
  PAUSE second*2<br />
  TOGGLE EWTG<br />
  TOGGLE EWTY<br />
  PAUSE 3*second<br />
  direction = 0<br />
 ENDSELECT<br />
LOOP<br />
END</p>
<p>&#8216; SUBROUTINES<br />
AllRed:<br />
 GOSUB AllOff<br />
 HIGH NSTR<br />
 HIGH EWTR<br />
 HIGH NSPR<br />
 HIGH EWPR<br />
 RETURN<br />
END</p>
<p>Test:<br />
 FOR y = 0 TO 3<br />
  FOR x = 0 TO 15<br />
   &#8216; Valid Lights @ 0,1,3,4,5,10,11,13,14,15<br />
   IF (x=2 OR x=6 OR x=7 OR x=8 OR x=9 OR x=12) THEN Skipit<br />
   TOGGLE x<br />
   PAUSE second/10<br />
  Skipit:<br />
  NEXT<br />
 NEXT<br />
 RETURN<br />
END</p>
<p>AllOff:<br />
 FOR x = 1 TO 15<br />
  LOW x<br />
 NEXT<br />
 RETURN<br />
END</p>
<p>AllOn:<br />
 FOR x = 1 TO 15<br />
  HIGH x<br />
 NEXT<br />
 RETURN<br />
END</p>
]]></content:encoded>
	</item>
</channel>
</rss>

