Skip to content

Latest commit

 

History

History
130 lines (93 loc) · 4.64 KB

api.md

File metadata and controls

130 lines (93 loc) · 4.64 KB

Classes

Photocell

Represents a single photoresistor wired to a GPIO pin and a capacitor. Light levels are measured by timing how long it takes to fill the capacitor, which is determined by the resistance of the photocell. The photocell's resistance, in turn, is determined by how much light it receives.

Photocell

Photocell

Represents a single photoresistor wired to a GPIO pin and a capacitor. Light levels are measured by timing how long it takes to fill the capacitor, which is determined by the resistance of the photocell. The photocell's resistance, in turn, is determined by how much light it receives.

Kind: global class

new Photocell(pin)

Create a new instance of Photocell

Returns: Object - an instance of Photocell

Param Type Description
pin number The GPIO pin number on the Raspberry Pi

photocell.measure() ⇒ Promise.<number>

Measure light level asynchronously.

Kind: instance method of Photocell
Returns: Promise.<number> - A promise that resolves to the amount of time it took to fill the capacitor (in microseconds)
Emits: measure, reading

photocell.measureSync() ⇒ number

Measure light level synchronously

Kind: instance method of Photocell
Returns: number - The amount of time it took to fill the capacitor (in microseconds)
Emits: measure, reading

"measure"

Signifies that measurement of light levels has begun

Kind: event emitted by Photocell

"reading" (reading)

Fires when a measurement has completed and a reading is ready

Kind: event emitted by Photocell

Param Type Description
reading number The reading reported

Photocell

Kind: global class

new Photocell(pin)

Create a new instance of Photocell

Returns: Object - an instance of Photocell

Param Type Description
pin number The GPIO pin number on the Raspberry Pi

photocell.measure() ⇒ Promise.<number>

Measure light level asynchronously.

Kind: instance method of Photocell
Returns: Promise.<number> - A promise that resolves to the amount of time it took to fill the capacitor (in microseconds)
Emits: measure, reading

photocell.measureSync() ⇒ number

Measure light level synchronously

Kind: instance method of Photocell
Returns: number - The amount of time it took to fill the capacitor (in microseconds)
Emits: measure, reading

"measure"

Signifies that measurement of light levels has begun

Kind: event emitted by Photocell

"reading" (reading)

Fires when a measurement has completed and a reading is ready

Kind: event emitted by Photocell

Param Type Description
reading number The reading reported