How to read channel 1 from 1045 ver.101

Supporting Browser-based Javascript and Node.js
dts350z
Fresh meat
Posts: 2
Joined: Wed Jul 04, 2018 2:22 pm
Contact:

How to read channel 1 from 1045 ver.101

Postby dts350z » Wed Jul 04, 2018 2:28 pm

I have a 1045 IR Temp sensor.

I'm using the example TempratureSensor.html and Phidget22 libs to read the IR temp, and I've also added a chart with dygraph.js

Now I would like to add the IC temp on channel 1, but looking at the javascript I don't see how to do it.

Please advise.

Thanks,
Z

User avatar
mparadis
Site Admin
Posts: 656
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: How to read channel 1 from 1045 ver.101

Postby mparadis » Fri Jul 06, 2018 7:47 am

Inside

Code: Select all

$(document).ready
, you need to define a second TemperatureSensor object. Then, you need to set the channel for that object to 1, which is the index for the IC sensor (as listed on the API tab on the 1045 product page). It would look something like this:

Code: Select all

var ir = new phidget22.TemperatureSensor();
var ic = new phidget22.TemperatureSensor();

ir.setChannel(0);
ic.setChannel(1);


Then where you see

Code: Select all

open()
called, use open on the other object as well.

dts350z
Fresh meat
Posts: 2
Joined: Wed Jul 04, 2018 2:22 pm
Contact:

Re: How to read channel 1 from 1045 ver.101

Postby dts350z » Fri Jul 06, 2018 11:52 am

Yeah I slogged through it and got it working.

Thanks!

screen shot:
[url]https://drive.google.com/file/d/150gGOjJ_twXQgxZbBrz0EHDUUO-qOv4d/view?usp=sharing
[/url]

FYI I made a "cloud sensor". Pointing the IR sensor at the night sky, it will read below 0 degrees C if no clouds. Clouds will read higher than 0 degrees C.

This is useful in astrophotography as by looking at the graph you can tell why everything stopped working (clouds) and do things like close your observatory roof.


Return to “Javascript”

Who is online

Users browsing this forum: No registered users and 1 guest