Advanced Lesson

Using the Sensor API

In this lesson, you will learn how to use the application programming interface (API) to find methods and events that are specific to your Phidget.

APIs

Every Phidget has an API that provides information about all of the methods and events available to that Phidget. An API is like a reference library for a computer programmer, if you are not sure how to change a setting or access a piece of information, the API is the first place to check.

Note: the API below assumes you have an understanding of the following topics:

APIs

Every Phidget has an API that provides information about all of the methods and events available to that Phidget. An API is like a reference library for a computer programmer, if you are not sure how to change a setting or access a piece of information, the API is the first place to check.

Note: the API below assumes you have an understanding of the following topics:

APIs

Every Phidget has an API that provides information about all of the methods and events available to that Phidget. An API is like a reference library for a computer programmer, if you are not sure how to change a setting or access a piece of information, the API is the first place to check.

Note: the API below assumes you have an understanding of the following topics:

APIs

Every Phidget has an API that provides information about all of the methods and events available to that Phidget. An API is like a reference library for a computer programmer, if you are not sure how to change a setting or access a piece of information, the API is the first place to check.

Note: the API below assumes you have an understanding of Closing Phidgets.

Humidity Phidget API

Watch the video below for information on how to use the API.

API

Exploring the API

Finding a Device's API

Every Phidget has an API. You can view a device's API by selecting the device from the Device Tutorials page and then scrolling to the bottom of the page.

Remember...

When starting with a new Phidget, it's a good idea to review the API so you can familiarize yourself with all of the features that are available to you. The API you are exploring is the same API that any Phidget user sees (even professionals!), so there may be some items listed that require more advanced computer science knowledge.

Practice

  1. Use the HumiditySensor API to print the range of humidity values the Humidity Phidget can output.
  2. Use the TemperatureSensor API to print the range of values the Data interval can be set to.
  3. Use the TemperatureSensor API to write a program using Events that only prints the temperature change when the temperature has changed by more than 1 degree. Hint: You will only have to add one line of code to the code sample in the Smart Phidget Event Lesson.
Solutions available for educators. Email us for access.

What are Phidgets?

Phidgets are programmable, modular USB devices, either sensors or controllers that you can connect together. Simply write code in your favorite language and solve real-world problems.

Learn more

Set your preferences

Windows

Mac OS

Raspberry Pi

Java

Python

C#

Swift

NetBeans

Processing

Eclipse

Thonny

PyCharm

PyScripter

Visual Studio

Xcode

Setting your preferred operating system, programming language and environment lets us display relevant code samples for the Getting Started Tutorial, Device Tutorials and Projects

Done