element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Help in Arduino
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 4 replies
  • Subscribers 391 subscribers
  • Views 349 views
  • Users 0 members are here
  • arduino
Related

Help in Arduino

Former Member
Former Member over 9 years ago

Hello sir,

I am a starter in Arduino. I need a little help.

My doubt is.. I have 2 analog sources and i need to convert it to digital through ADC converter. Then i need to read the digital values. If my source 1 is equal to 5volts then i should get it as output. if source 1 is less than 5 volts then i should shift to source 2 and get it as output.

 

I can find the concept like what i should use. but i cant execute it through arduino since i am new to this. Its urgent. Please reply as soon as possible sir.

Thanks.

 

Regards,

Swathy

  • Sign in to reply
  • Cancel
Parents
  • strb
    strb over 9 years ago

    Hi

    If you want to read an analog value you have to use analogRead(Ax), where x is the number of the analog input you choose, for example:

     

    int in0=0;//define a variable

    in0=analogRead(A0);//read the analog value from A0 and save it in in0

     

    then you need to see if it is near to 5v and you can make it with an if that compare your analog input with a threshold.

    What do you mean with "get it as output"? Do you have to see it on your pc?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to strb

    Hey,

     

    Thanks for your reply.

     

    So its like i need to get 2 analog inputs and the convert it to digital.

    Later, input 1 should be equal to 5volts. If so, then the input 1 should be

    given as output else input 2.

     

    For output, I am integrating arduino with lab view. There i would be

    getting what i have programmed here.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • strb
    strb over 9 years ago in reply to Former Member

    About 3 years ago I also made a small project with arduino and labview, I installed visa driver for the communication between arduino and lv, with arduino you can use usb like a serial port, you first have to set the speed of communication in the void setup with Serial.begin(x), x is the speed in bit/s (of course you have to set the same speed in your pc program, you can choose 300,1200,2400,4800,9600,14400,19200,28800,38400,57600,115200 ), to send a string you can use Serial.print() or Serial.println() and then you can convert it back to a number using the specific function in lv

    example of sketch:

     

    //variable and costant statement

    int info=0;

     

    void setup()

    {

         //other initializations

         Serial.begin(9600);//set to 9600 bit/s

    }

     

    void loop()

    {

         //your program

         Serial.print(info);//send the number stored into "info"

    }

     

    ps:remember that with standard setup you can only sample up to 9/10 khz

    I hope it will help and sorry if I made any grammar mistakes, I've to improve my english image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to strb

    Thank you so much. If i have any queries while taking it forward, I will

    send u a mail.

     

    Regars,

    Swathy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 9 years ago in reply to strb

    Thank you so much. If i have any queries while taking it forward, I will

    send u a mail.

     

    Regars,

    Swathy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube