Chapter 5
Getting Started with Measurement Studio
©
National Instruments Corporation
5-25
Measurement Studio User Manual
Return values
End Function
Sub Main()
Const location As String = "\\localhost\system\double"
Dim bufferedWriter As NetworkVariableBufferedWriter(Of Double()) =
New
NetworkVariableBufferedWriter(Of Double())(location)
bufferedWriter.Connect()
Dim phase As Integer = 0
While (True)
Dim values As Double() = GenerateDoubleArray(phase)
Console.WriteLine("Writing Array")
bufferedWriter.WriteValue(values)
Thread.Sleep(500)
phase = phase + 1
End While
End Sub
End Module
[C#]
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using NationalInstruments.NetworkVariable;
namespace NetworkVariableWriter
{
class Program
{
private static double[] GenerateDoubleArray(double phase)
{
double[] values = new double[1000];
for (int x = 0; x < 1000; x++)
values[x] = Math.Sin(((2 * Math.PI * x) / 1000) + phase) * 2;
return values;
}
static void Main(string[] args)
{
const string Location = @"\\localhost\system\double";
NetworkVariableBufferedWriter<double[]> bufferedWrite = new
NetworkVariableBufferedWriter<double[]>(Location);
bufferedWrite.Connect();
int phase = 0;
while (true)
{
double[] value = GenerateDoubleArray(phase);
Console.WriteLine("Writing array");