Quickstart Guide
Introduction RIO Academic RIO Application examples Your first RT app Your first FPGA app
Basic procedures System admin File system I/O monitor System controller architecture Timed loops Inter-process communication RT/Host communication RT/FPGA communication FPGA personalities Interrupts Datalogger (file I/O)
Design flow Simulation Inter-process communication RT/host communication Derived clock domain IP blocks FPGA personality
Get connected Email Web services UDP TCP IP addresses
Site Map
Guides Code examples Procedures Tags LabVIEW block diagram elements Targets Communications All pages
Glossary How to use About
RIO Developer Essentials Guide for Academia
RT code example

Host a Web service

Host a web service on the Academic RIO Device to serve the states of onboard sensors (pushbutton and accelerometer) and system information (date, time, host name, and IP address), and to control the onboard LEDs based on a user-selected LED hex code.

LabVIEW RT block diagram snippet: Control onboard LEDs from web form data, return system date/time

Use cases


Keep in mind

LabVIEW block diagram elements

Locate these elements with "Quick Drop" (press Ctrl+Space and start typing the name); click on an icon to see more sample code that uses that element:

Read Form Data
Read Postdata
Set HTTP Response MIME Type
Write Response
Get Date-Time String
Format Into String
Flatten To JSON

Example code

Troubleshooting tips

  1. Failure to connect to target or deploy code – Try right-clicking on the “NI myRIO 1900” target and choosing “Disconnect” and then “Connect”. If this does not help, go ahead and power-cycle the Device.
  2. “Conflict Message: The Web Services deployment failed. An active NI Application Web Server was not detected on the target”. – This error indicates that the Device is missing the required software set add-on called “NI Application Web Server.” See manage the Academic RIO Device software set add-ons to learn how to install this required software add-on.

Suggested modifications

Evaluate your ability to host a LabVIEW-based Web service by modifying one of the existing demo VIs to perform one or more of the following tasks: 1. Serve a sensor measurement from any of the sensors described in the NI myRIO Project Essentials Guide (temperature, ambient light intensity, proximity, acceleration, angular velocity, vibration, magnetic field, etc., see the table of contents for the complete list). 1. Control an indicator or actuator for any of those described in the NI myRIO Project Essentials Guide (seven-segment LED display, LCD display, LED matrix, motor, servomotor, etc.)

Expected results

https://youtu.be/2-9CLWOrWko (7:54)

Developer walk-through

https://youtu.be/EkbszuTF1j0 (13:53)

For more information