Thread: toggle switches and LEDs

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    19

    toggle switches and LEDs

    can anyone tell me what are the codes to write a program such that when i toggle a toggle switch, an LED will turn on, and do i actually have to declare or initiate the toggle switches and LEDs?

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    124
    >when i toggle a toggle switch, an LED will turn on
    I understand nothing...

    But i don't think many people here give codes without seing effort
    Loading.....
    ( Trying to be a good C Programmer )

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    19
    i did put in effort but i had to learn everything on my own coz i am totally new to c programming without any teacher teaching

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    124
    Ok, you might mean something else, i might understand something else.
    But, can you be a little more specific - and get better answers?
    Loading.....
    ( Trying to be a good C Programmer )

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    19
    ok... every toggle switch has a 'high'(VCC) and a 'low'(GND) pin right? what i mean was that when i switch it to high, an LED would light up

  6. #6
    Registered User
    Join Date
    Jun 2003
    Posts
    124
    Ah!!!!! So you are talking about that LED!!
    And what programming has to do with it?
    Loading.....
    ( Trying to be a good C Programmer )

  7. #7
    Registered User
    Join Date
    Jul 2003
    Posts
    19
    yes it does. my supervisor asked me to write a program to show digital input and digital output on the board in this way, the toggle switch is for digital input and the LED is for digital output

  8. #8
    Registered User
    Join Date
    Jul 2003
    Posts
    19
    its not attached in my PC, they are attached to an external card with a CY7C64613 chip.

  9. #9
    Registered User terryrmcgowan's Avatar
    Join Date
    Jun 2003
    Posts
    8
    Hi cprogrammer2003,

    It would seem, from this and other posts that you 've made, that what you are trying to do is connect some piece of Hardware via the USB port, to a program running within the machine so that the program can send and receive input and output from your Hardware? I think this is quite a lot to attempt, unless your level of programming ability is quite high and you are pretty good with electronics. Unfortunately I am not good enough at either to help but I think your supervisor is either taking the p**s or doesn't understand what is involved. IMO you should begin with the basics of C and then gradually move on to more complicated stuff, not jump in to dead hard stuff

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    124
    >I think your supervisor is either taking the p**s or doesn't understand what is involved. IMO you should begin with the basics of C and then gradually move on to more complicated stuff, not jump in to dead hard stuff

    Oh yeah!! That's what i'm talking about!
    Loading.....
    ( Trying to be a good C Programmer )

  11. #11
    Registered User
    Join Date
    Jul 2003
    Posts
    19
    yeah terryrmcgowan, you are right about that, thats what i want to do. i also noe i need some time to study the basics of those electronics and c programming stuff but the problem is i am not given much time for this...

  12. #12
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    Many microcontrollers deal with digital input/output with bitmasks. What salem showed you with the LED variable is mostly accurate.

    Does your program run on the PC or the card? If it runs on the card, toggling the LED should be all you need to do. If it runs on the PC, how does it connect with the card?

    Look into 8051 programming. Chances are this is what you're looking for. Find the LED which corresponds with the lead you're looking for.


    (Disclaimer: I'm not sure about anything I just said. It's just an educated guess.)

Popular pages Recent additions subscribe to a feed