Basic Stamp 2 Project 1 - Tri - color LED

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
2,202
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Oct 10, 2010

This is my first Basic Stamp 2 Project. I control a Tri - Color LED by typing the letter of the color (G or B). I couldn't use the red color because i didn't have the proper resistor...




Oh and the Basic Stamp 2 Micro controller is made by PARALLAX Inc.

Circuit Diagram :

http://img241.imageshack.us/img241/9060/ledd.jpg


NOTE: The resistor depends on the led you're using. To calculate the necessary resistor go to this webpage:

http://metku.net/index.html?sect=view&n=1&path=mods/ledcalc/index_eng...

Code :

' {$STAMP BS2}
' {$PBASIC 2.5}

Dat VAR Word ' Make a Variable called Dat


LOW 2
LOW 3

DO ' Start a loop.

DEBUGIN Dat ' Write the letter typed on the terminal to the variable.

IF Dat = "g" THEN ' Wait for g being typed
LOW 2
HIGH 3 ' If so, put pin 3 on high, which will turn the led Green.
DEBUG "LED Is now green." ,CR 'Indicate that the led is green.
ELSEIF Dat = "b" THEN ' Wait for b being typed.
LOW 3
HIGH 2 ' If so, put pin 2 on high which will turn the LED Blue.
DEBUG "LED Is now blue." ,CR ' Indicate that the led is blue
ELSE
ENDIF

LOOP ' End the loop.

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (xXjose130Xx)

  • You know if u get some variable resistors, you can make any color.

  • @TheBasicStamp you can also use a digital pot to fade between the colors

see all

All Comments (4)

Sign In or Sign Up now to post a comment!
  • @xXjose130Xx That is true. I thought of doing that but I only had one =(

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more