Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

C++ API for National Instruments myRIO

License

NotificationsYou must be signed in to change notification settings

eviallet/myWRIO

Repository files navigation

C++ API for National Instruments myRIO

This is a framework to use with myRIO. It allows the user to code on the myRIO without LabVIEW.It is based on the official C API, but handles registers communications to provide a high level, arduino like programming.

Documentation found here

The docs are generated with Doxygen. Each line of code is documented and examples are provided for each class.There is a guide to setup Eclipse to use our API.

  • Blink a LED
#include"MyRIO.h"usingnamespacemyRIO;intmain() {if(!myRIO_init()) {std::cout <<"Error initializing myRIO";return -1;}bool status = HIGH;while(1) {        status=!statusDIO::writeLed(LED1, status);Time::wait_ms(500);    }}
  • Output a PWM signal
#include"MyRIO.h"usingnamespacemyRIO;usingnamespacestd;intmain() {if(!myRIO_init()) {cout <<"Error initializing myRIO";return -1;}// Output a 10kHz, 3.3V PWM signal with a duty cycle of 25% for 10 seconds    PWMchannelC0(PWMC0,10e3,25);Time::wait_s(10);}
  • Generate a sine with AIO class (Analog Input Output)
#include"MyRIO.h"usingnamespacemyRIO;usingnamespacestd;intmain() {if(!myRIO_init()) {cout <<"Error initializing myRIO";return -1;}double fq =100;double vpp =4;double outputFq =100e3;    Time timer =Time::stopwatch();    timer.reset();while(1) {AIO::writePin(CO0, (vpp/2)*sin(2*3.141592653*fq*timer.elapsed_ns()*1e-9));// we cannot measure more than 2 seconds ; reset it before it's too lateif(timer.elapsed_ns() >= 1e9L)            timer.reset();// convert the frequency to time, then the time to µsTime::wait_us(1e6/outputFq);    }return0;}
LEDs exampleMotorPID exampleReal time angle supervision (external I2C gyroscope)And a car
Youtube video 2Youtube video 2Youtube video 2Youtube video 2

About

C++ API for National Instruments myRIO

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp