Shop OBEX P1 Docs P2 Docs Learn Events
I am trying to control an LED using a computer interface. — Parallax Forums

I am trying to control an LED using a computer interface.

ControllingChipControllingChip Posts: 2
edited 2007-10-17 13:55 in BASIC Stamp
I am trying to control an LED using a computer interface.
Can any one give me some ideas, because this is my first task to use microcontrollers.

the interface should have a button, once the user click on it the LED should turn on.

thanks

Post Edited By Moderator (Chris Savage (Parallax)) : 10/16/2007 3:49:26 PM GMT

Comments

  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2007-10-15 22:01
    ControllingChip--

    Are you trying to do this using a Stamp? If so, which one?

    Although I am almost as new as you seem to be to the arena of microcontrollers, what you are attempting to do is easy with any of·the Stamps.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-10-15 22:04
    This thread is a duplicate. ControllingChip, please post in one forum only. Also, you'll get a much better response if you include a descriptive subject line.

    -Phil
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2007-10-15 22:12
    First, welcome to the Parallax forums.

    Second, double-posting is highly discouraged! Try to post only to the forum that is most relevant to your needs. If there is ever any question as to where to post, post in the Sandbox, with a polite request for the mods to move the post if needed.

    Okay, assuming that you just want to turn the LED "on", and are writing a computer program in Microsoft Visual Basic .Net, the process works something like this:

    VB.Net program has a single button. When the button is clicked, program does the following:
    - Opens a serial port connection
    - Writes a "command" (can be a letter, number, sequence, etc.) to the
    serial port that is open
    - Closes the serial port connection

    Meanwhile, on the BasicStamp/SX/Propeller, there is a program running that does this (essentially):
    - Wait for a serial input on some pin
    - Parse the input that's received
    - Do something based on the received input

    So, if your computer button sends a "1", your PBasic program would do this (in pseudocode):

    SERIN... someCommand
    if SomeCommand = 1
    then TurnOnLED


    So, from that general description, and following the basic concept, you can build all types of control systems. You have two program that each take turns sending & receiving, doing something based on what is communicated.
  • metron9metron9 Posts: 1,100
    edited 2007-10-16 05:11
    If you are using C# I have code you can use if you like. This is a simple window that opens a serial port and sends a number starting at 1 going up to 255. It uses C# and a USB port that uses a USB to Serial cable. The processor sending the RED line on the scope is a tiny2313 using it's Built in USART set at 230,400KBPS using a 14.7456 crystal for the clock. I use a rs485 tranceiver chip to change the serial port output to 0..+5V to the tiny2313's receive pin.

    You can download for free C# 2005 Express , I have not yet worked on sending data to the PC from the microcontroller.

    http://acousticlights.com/baudrate.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • ControllingChipControllingChip Posts: 2
    edited 2007-10-16 14:47
    Thanks a lot for the reply

    yes I am using using the the BASIC Stamp to ON/OFF control of an LED.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-16 15:49
    Phil Pilgrim (PhiPi) said...
    This thread is a duplicate. ControllingChip, please post in one forum only. Also, you'll get a much better response if you include a descriptive subject line.
    Duplicate post removed.· Subject added to this one.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • DgswanerDgswaner Posts: 795
    edited 2007-10-17 13:55
    You can control 8 LEd's directly from your computer via the Printer port. so I guess it depends on your reasons for controlling leds and your ultimate goal.
    just Google controlling LED Printer port control.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
Sign In or Register to comment.