Thread: Light On/Off using C program

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    3

    Cool Light On/Off using C program

    How to make light on or off using C program....

    I know it needs a parellel port...
    bt i dnt knw what codes we have to write n what are the ground n o/p slots in par port....

    kindly give me full exlpaination??

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Well simply put, to make a light turn on or off, you just need hardware capable of doing that, and a way to interface with that hardware. What kind of light are wanting to control? Are you talking about a little LED, or were you thinking of making a program to control the lights in your house? You may want to look at microcontrollers - you can buy general purpose circuits that come with C compilers, documentation, etc... and are capable of controlling switches, etc...

    PIC microcontrollers are very popular and easy to program for - but again, you'll probably get different recommendations depending on exactly what you want to do.

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    3
    Actully my sir told me that we can use parallel port and by making c codes, it can be switch on/off LED or any light....

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I suppose it's possible, if the parallel port can output enough current to make it shine.
    But I wouldn't know what pin that is.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5

  6. #6
    Registered User
    Join Date
    Aug 2009
    Posts
    3

    Cool

    Yeah I gone through the above link n its nice...

    but i wanna only those 5-7lines program by wich i cn simply ON or OFF the light/LED....
    a simple program to search parallel port n to give output to that port so i can get votlage to glow the LED....

  7. #7
    Registered User
    Join Date
    Sep 2008
    Posts
    2
    Quote Originally Posted by shreyas_222 View Post
    Yeah I gone through the above link n its nice...

    but i wanna only those 5-7lines program by wich i cn simply ON or OFF the light/LED....
    a simple program to search parallel port n to give output to that port so i can get votlage to glow the LED....
    OP (shreyas_222):
    Never use SMS texts in serious forums as these.
    I can see that you are serious about resolving your question (you have made some effort yourself, already), but by writing in SMS forms and slangs you tend to reduce seriousness. Honest feedback.

    Best.
    Last edited by Ananda; 09-13-2009 at 12:49 AM.

  8. #8
    1337
    Join Date
    Jul 2008
    Posts
    135
    The link above is nice. However, it is already old. Hope someone will post a better topic on microcontrollers. I totally agree with sean where he says
    PIC microcontrollers are very popular and easy to program for
    It was developed by Harvard i think and it is easily available. I would appreciate too if anyone could recommend a book on programming microcontrollers. Lets hack the microwave!

  9. #9
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    I think you could do it directly from the computer if you have a separate voltage source, then control switches (relays or fets) from your port using ioctl.h or similar.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM