- 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
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
- Photocell
- new Photocell(pin)
- .measure() ⇒
Promise.<number>
- .measureSync() ⇒
number
- "measure"
- "reading" (reading)
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 |
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
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
Signifies that measurement of light levels has begun
Kind: event emitted by Photocell
Fires when a measurement has completed and a reading is ready
Kind: event emitted by Photocell
Param | Type | Description |
---|---|---|
reading | number |
The reading reported |
Kind: global class
- Photocell
- new Photocell(pin)
- .measure() ⇒
Promise.<number>
- .measureSync() ⇒
number
- "measure"
- "reading" (reading)
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 |
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
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
Signifies that measurement of light levels has begun
Kind: event emitted by Photocell
Fires when a measurement has completed and a reading is ready
Kind: event emitted by Photocell
Param | Type | Description |
---|---|---|
reading | number |
The reading reported |