I'm pretty new to the phidgets comunity, and to the C# language and to the use of phidgets as well.
I'm here because i'm needing help to use my new Precision Voltage Sensor 1135. It's linked to my PC with a 1011 PhidgetInterfaceKit 8/8/8
Can someone help me with the writing of code with these devices?
I only want to read the value returned by my Phidgets, and I struggle to use the exemples (wich does too much for me) and even with the basics tutorials my codes won't work..
I don't know what I'm doing wrong..
Here is the code i made (surely full of mistakes)
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Phidget22;
using Phidget22.Events;
namespace Phidget22
{
public enum VoltageSensorType
{
PN_1135 = 11350,
}
}
namespace Phidget22.Events
{
//
// Résumé :
// VoltageInput SensorChange Event data
public class VoltageInputSensorChangeEventArgs : EventArgs
{
//
// Résumé :
// The sensor value
public readonly double SensorValue;
//
// Résumé :
// The sensor unit information corresponding to the sensor value. Helps keep track
// of the type of information being calculated from the voltage input.
public readonly UnitInfo SensorUnit;
}
}
namespace testLectureTension
{
class Program
{
public static double SensorValue { get; }
public static UnitInfo SensorUnit { get; }
public static VoltageSensorType SensorType { get; set; }
public static void Vin_SensorChange(object sender, VoltageInputSensorChangeEventArgs e)
{
Console.WriteLine(e.SensorValue);
}
static void Main(string[] args)
{
VoltageInput vin = null;
DigitalInput ch;
ch = new DigitalInput();
ch.Open();
//vin.SensorType = VoltageSensorType.PN_1135;
while (true)
{
Console.WriteLine(Program.SensorValue);
Console.WriteLine(Program.SensorUnit);
//Vin_SensorChange(VoltageSensorType.PN_1135, );
System.Threading.Thread.Sleep(300);
}
}
}
}
Thank you for anyone trying to help me