TemperatureSensor-full(C# sample program)

Supporting Visual Studio on Windows
Chili Padi

Re: TemperatureSensor-full(C# sample program)

Postby Chili Padi » Fri Jul 29, 2011 1:57 am

I have edited the program but i can't edit the value or let it detect which analog input the sensor is being pulgged in as i can't find the code. :?

erik
King of the Lab
Posts: 476
Joined: Fri Mar 06, 2009 12:42 pm
Location: Calgary, Canada
Contact:

Re: TemperatureSensor-full(C# sample program)

Postby erik » Fri Jul 29, 2011 8:49 am

The SensorValue is changed in the SensorChange event handler.

Code: Select all

sensorInArray[e.Index].Text = e.Value.ToString();

on line 275 of Form1.cs

What it sounds like you would want to do is change it to something like

Code: Select all

if(e.Value > 5)
{
    sensorInArray[e.Index].Text = (Formula for 1124 * e.Value).ToString();
}


e.Index is the Analog Port that the change is coming on and e.Value is the SensorValue of the Analog port.

This will only change it in the main InterfaceKit-full GUI, and not in the AdvancedSensorForm GUI. Of course if you plug in a different sensor into the port, it will incorrectly display it's value as a temperature when it may be a different kind of sensor.

Chili Padi

Re: TemperatureSensor-full(C# sample program)

Postby Chili Padi » Tue Aug 02, 2011 2:27 am

I have made a GUI similar to advancedSensorForm but the value would not be displayed.The GUI made is not selectable of different sensor instead it is fix but the value still does not appear.

I have tried the method posted on the the previous post but it did not appear. I know I have to edit the code but I'm not sure whether to edit it in Form1.cs or the GUI I made to let the value appear. :(


Return to “C#.NET”

Who is online

Users browsing this forum: No registered users and 8 guests