| ??? 01/08/02 06:54 Read: times |
#18434 - RE: This is not the end of it: |
Hi,
Ok with the above you can very well pulse-illuminate the LED with just one button. But, If your question is not to just test and discuss the possibility of doing it that way with switch and LED both on one port then, I beleive you are doing an application and your code has to run on it which has many other devices connected for on/off or interface. (that is the case because you have left with only one pin). If this is the case then of course you have to also associate some action in your code with the switch. and the LED on the same pin to indicate that the action is active or not active. Say for example you want to turn a relay ON when you press the switch one time and with that LED also illuminates to indicate the ON state of the relay. and when you press the switch second time the relay goes OFF and so does LED. But, mind you when you have pulled the port low by pressing the switch, it turns the relay ON and also it starts the timer that pulse-illuminates the LED during low period and polls the switch during high period. Now suppose the relay is ON and LED is pulsed and your switch is not pressed: then on very next high or low period (depending on the logic in your code) your relay is going to go OFF. and on the next cycle it will toggle again and again ..... So the result is your relay will chatter at the same duty cycle your LED is pulsed at. Becuse when the port goes low or high during pulse, your code which is reading the port will assume an action from outside switch. There is a solution to that !!! Simon |
| Topic | Author | Date |
| Led/Button | 01/01/70 00:00 | |
| RE: Led/Button | 01/01/70 00:00 | |
| RE: Led/Button | 01/01/70 00:00 | |
| RE: Led/Button | 01/01/70 00:00 | |
| RE: This is not the end of it: | 01/01/70 00:00 | |
| RE: This is not the end of it: | 01/01/70 00:00 | |
| RE: This is not the end of it: | 01/01/70 00:00 | |
RE: This is not the end of it: | 01/01/70 00:00 |



