element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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
NI
  • Products
  • Manufacturers
  • NI
  • More
  • Cancel
NI
Blog How to Turn a Button On with Python and mioDAQ
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join NI to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: timifolayan
  • Date Created: 27 Jul 2026 7:53 PM Date Created
  • Views 324 views
  • Likes 6 likes
  • Comments 0 comments
Related
Recommended

How to Turn a Button On with Python and mioDAQ

timifolayan
timifolayan
27 Jul 2026

Hello, my name is Timi Folayan and I am a SDE intern here at NI. I've noticed most of the community's DAQ content assumes you're using LabVIEW, which makes sense - it's the flagship tool. But I come from a software engineering background, and I wanted to see how far I could get controlling a mioDAQ using nothing but Python and the official nidaqmx-python API.

This is the first post in a short series where I'll build up complexity one step at a time: this post just turns an LED on, the next will read a button press, and eventually I'll combine input and output into something interactive. Starting simple on purpose - if you're newer to hardware, this is meant to be a post you can follow along with on your own bench.

What you'll need

  • NI mioDAQ
  • Breadboard
  • 1x illuminated pushbutton (red)
  • 1x 10k Ω resistor
  • Jumper wires
  • Python 3.8+ with nidaqmx installed (pip install nidaqmx) and the NI-DAQmx driver installed

*A note on scope*

This post only turns the pushbutton's built-in LED on - it doesn't read the button press yet. I'm keeping input and output separate for now so each post in the series stays focused on one concept at a time.

Wiring it up

image

The LED lead from the pushbutton connects to P0.0 through a 10kΩ current-limiting resistor. The other LED lead ties into the mioDAQ's DGND. That's it for this post - the switch contacts on the pushbutton aren't wired yet.

image

image

Two ways to write to an mioDAQ: analog vs. digital

The nidaqmx-python examples repo includes both analog and digital output patterns. Since a pushbutton LED is a simple on/off device, digital output is the right fit here — but it's worth seeing the analog version too, since it's the same basic task/channel pattern applied to a continuous voltage instead of a binary line.

image

Analog output writes a specific voltage value (here, 10.0 V) to an analog channel - useful for things like driving a motor speed or simulating a sensor signal, where you need more than just on/off.

The digital output code (what I'm actually using)
image


Demo Video: 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image


Reference

The examples I started from are in the official nidaqmx-python repo: github.com/ni/nidaqmx-python - worth a look if you want to see the full range of what the API covers beyond digital and analog output.

Up next

Post 2 in this series will read the pushbutton's actual switch state as a digital input - the first step toward making this interactive instead of just scripted.

  • Sign in to reply
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 © 2026 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.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube