Device API
Device Information
getDeviceName()
getDeviceName()
Returns the device name.
getManufacturer()
getManufacturer()
Returns the sensor manufacturer (AMS).
setI2cAddress(I2cAddr newAddress)
setI2cAddress(I2cAddr newAddress)
Sets a new I2C address for the device.
getI2cAddress()
getI2cAddress()
Gets the current I2C address.
doInitialize()
doInitialize()
Performs internal initialization and verifies sensor communication.
Color & Light Functions
classifyColor()
classifyColor()
Classifies perceived color using RGB thresholds. Returns:
"Red"
, "Green"
, "Blue"
, "Yellow"
, "Cyan"
, "Magenta"
, "White"
, "Black"
, "Unknown"
.
argb()
argb()
Returns packed 32-bit Android-style ARGB color.
getNormalizedColors()
getNormalizedColors()
Returns normalized alpha, red, green, and blue in [0,1] range.
alpha()
alpha()
Reads the clear (ambient) light channel.
getRawLightDetected()
getRawLightDetected()
Returns normalized ambient light intensity.
getLightDetected()
getLightDetected()
Returns normalized light detection (same as above).
getRawLightDetectedMax()
getRawLightDetectedMax()
Returns max possible raw light value (65535).
red()
red()
Reads the red channel.
green()
green()
Reads the green channel.
blue()
blue()
Reads the blue channel.
Distance & Proximity Functions
getDistance(DistanceUnit unit)
getDistance(DistanceUnit unit)
Returns calibrated proximity-based distance in specified units.
getProximity()
getProximity()
Returns raw proximity value (0–255).
setProximityGain(ProximityGain gain)
setProximityGain(ProximityGain gain)
Sets proximity gain (1x, 2x, 4x, 8x).
setProximityLedPulses(int pulses)
setProximityLedPulses(int pulses)
Sets number of IR LED pulses (1–64).
setProximityLedPulseLength(ProximityPulseLength pulseLength)
setProximityLedPulseLength(ProximityPulseLength pulseLength)
Sets IR LED pulse duration (4µs, 8µs, 16µs, 32µs).
configureProximitySettings(ProximityGain gain, int pulses, ProximityPulseLength pulseLength)
configureProximitySettings(ProximityGain gain, int pulses, ProximityPulseLength pulseLength)
Configures gain, pulse count, and pulse length in one call.
Utility
String status()
String status()
Returns connection status string.
Last updated
Was this helpful?