LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Serial port interfacing (https://www.linuxquestions.org/questions/linux-general-1/serial-port-interfacing-728139/)

payu21 05-24-2009 05:11 AM

Serial port interfacing
 
Hi,

I am making a light sensor project.
I have measured light using LDR and saved it in my PC in a variable....

Now i want my LED at the output to turn ON with the voltage that is stored in the PC. For this i am supposed to use Serial port....

Can anyone help me in writing the code for this???

MS3FGX 05-24-2009 09:33 AM

If I am understanding you correctly, you want to output a variable voltage out of a serial port so that you can make a LED brighten/darken?

Unfortunately, it isn't that easy. A serial port is digital, what you are talking about is analog. You can only turn a pin on or off, not directly control it's voltage. You would need an digital to analog converter, which would be able to take binary output and translate that into a variable voltage.

Or else you could use the digital output of the serial port to drive PWM, that would allow you to change the brightness of the LED, but wouldn't change the voltage being supplied to it.


All times are GMT -5. The time now is 10:41 AM.