Page 1 of 1

Humidity/Temperature Sensor sample code

Posted: Fri Jul 29, 2011 7:44 pm
by CharlyKhul

I'm a beginner and i have just received my sensor but i can't find
any code sample for AS3 and the 1125 - Humidity/Temperature Sensor.
The Card i connect, folder com ok, webservice ok,
but there is no "sensor change" when i use "trace".

If some one can help me?
Thanks a lot!

Re: Humidity/Temperature Sensor sample code

Posted: Sun Jul 31, 2011 12:43 pm
by CharlyKhul
hi all,

I found a solution :

Code: Select all

import com.phidgets.*;

var phid:PhidgetInterfaceKit;
phid = new PhidgetInterfaceKit();"localhost", 5001,"", 176028);

phid.addEventListener(PhidgetEvent.DISCONNECT, onDisconnect);

function onConnect(evt:PhidgetEvent):void {
ipc.text = "Interface : connecté.";

function onDisconnect(evt:PhidgetEvent):void {

phid.addEventListener(PhidgetDataEvent.SENSOR_CHANGE, mudaValor);
function mudaValor(evt:PhidgetDataEvent):void {
var sensor6 = phid.getSensorValue(6);
var sensor7 = phid.getSensorValue(7);
var temperature = (sensor7*0.22222)-61.11;
temperature = Math.floor(temperature*100)/100;
temp.text = "Temperature : "+temperature+" C°";
var hygrometrie = (sensor6*0.1906)-40.2;
hygrometrie = Math.floor(hygrometrie*100)/100;
hyg.text = "Hygrométrie : "+hygrometrie+" %";
trace (sensor6);
trace (sensor7);

But now i am trying to find some code for the relay.

If some one have an idea :D

Re: Humidity/Temperature Sensor sample code

Posted: Tue Aug 02, 2011 8:27 am
by erik
The relay is also considered an InterfaceKit so you simply need to create another instance of InterfaceKit using the unique serial number and follow the same set-up of listeners, etc. By setting the outputs of the InterfaceKit, the associated relay will toggle.