Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 05-24-2009, 06:11 AM   #1
LQ Newbie
Registered: Apr 2009
Location: australia
Posts: 12

Rep: Reputation: 0
Serial port interfacing


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???
Old 05-24-2009, 10:33 AM   #2
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent---serial interfacing payu21 Linux - Newbie 7 05-24-2009 03:13 PM
Parallel port interfacing ochienged Programming 1 02-06-2009 01:34 PM
Serial/Parallel/Game Port Interfacing sparkyssb Programming 8 06-29-2006 02:41 PM
interfacing using parallel port divu Programming 1 04-13-2006 09:39 AM
interfacing using perl(parallel port) teao Programming 1 07-29-2003 04:47 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration