Phidget Relay Interface Kit 0_0_8

Legacy support with Phidget21
han

Phidget Relay Interface Kit 0_0_8

Postby han » Tue Jun 28, 2011 12:50 pm

Hello

I am trying to write a simple script in matlab to turn on a switch on my phidget relay after 30 minutes and am having a lot of trouble figuring out how to call and identify the device and the switches. As much help as possible would be appreciated. Thanks

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

Re: Phidget Relay Interface Kit 0_0_8

Postby erik » Tue Jun 28, 2011 1:17 pm

Take a look at the Getting Started in MATLab Manual, as well as the example code and API for MATLab under the Programming Link above.

han

Re: Phidget Relay Interface Kit 0_0_8

Postby han » Tue Jun 28, 2011 2:00 pm

Ive looked at the tutorial yet cannot seem to be able to call and identify the relay and cannot figure out any of the code to trigger specific switches

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

Re: Phidget Relay Interface Kit 0_0_8

Postby erik » Tue Jun 28, 2011 2:22 pm

Since the 0/0/8 is an InterfaceKit, you can use the same code as in the examples to open and create the handle to the Phidget. In order to set the Output state, you can replace the getSensorValue callib on line 27 in the analogin.m example file with:

Code: Select all

calllib('phidget21', 'CPhidgetInterfaceKit_setOutputState', ikhandle, i, outputState)


where 'i' is the index of the relay and 'outputState' is either 1 or 0 for true or false.

The API for MatLAB is very similar to the API for C/C++.


Return to “Matlab”

Who is online

Users browsing this forum: No registered users and 1 guest