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?
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?
>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 )
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
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 )
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
Ah!!!!! So you are talking about that LED!!
And what programming has to do with it?
Loading.....
( Trying to be a good C Programmer )
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
its not attached in my PC, they are attached to an external card with a CY7C64613 chip.
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
>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 )
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...
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.)