LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


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

Rep: Reputation: 0
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???
 
Old 05-24-2009, 09:33 AM   #2
MS3FGX
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.
 
  


Reply


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 02:13 PM
Parallel port interfacing ochienged Programming 1 02-06-2009 12:34 PM
Serial/Parallel/Game Port Interfacing sparkyssb Programming 8 06-29-2006 01:41 PM
interfacing using parallel port divu Programming 1 04-13-2006 08:39 AM
interfacing using perl(parallel port) teao Programming 1 07-29-2003 03:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:16 AM.

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