Skip to main content

A python package for the color sensor S11059-02DT

Project description

CsCntlr (Color-sensor Controller)

A python package for the color sensor S11059-02DT.

Installation

pip install CsCntlr

Getting Started

# First, create a CsCntlr instance
from CsCntlr import *
cs = CsCntlr()

# Then, select the mode to be used
cs.useFixedPeriodMode()
cs.useManualSettingMode()

# You can measure colors by using the code below
cs.cntlr.auto()

Examples for Fixed Period Mode

from CsCntlr import *
cs = CsCntlr()
cs.useFixedPeriodMode()

# You can specify the gain and the integration time (tint)
cs.cntlr.auto(gain='low', tint=2)

# gain should be 'low' or 'high' (low:high = 1:10)
cs.cntlr.auto(gain='lolo')
cs.cntlr.auto(gain='hi')

# tint should be from 0 to 3
# 3: 179.2 ms, 2: 22.4 ms, 1: 1.4 ms, 0: 0.0875 ms (per color)
cs.cntlr.auto(tint=100)
cs.cntlr.auto(tint='hi')

Examples for Manual Setting Mode

In this mode, the sensor goes to standby mode after the measurement.

from CsCntlr import *
cs = CsCntlr()
cs.useManualSettingMode()

# You can specify the manual integration time (man_tint)
cs.cntlr.auto(gain='high', man_tint=100, tint=0)
cs.cntlr.auto(man_tint=1)

# gain should be 'low' or 'high' (low:high = 1:10)
cs.cntlr.auto(gain='lolo')
cs.cntlr.auto(gain='hi')

# tint should be from 0 to 3
# 3: 358.4 ms, 2: 44.8 ms, 1: 2.8 ms, 0: 0.175 ms (per color)
cs.cntlr.auto(tint=100)
cs.cntlr.auto(tint='hi')

# man_tint should be from 0 to 65535
# measurement_time = tint * man_tint (per color)
cs.cntlr.auto(gain='high', man_tint=70000, tint=1)
cs.cntlr.auto(man_tint='hi')

Note: CsCntlr is Singleton

from CsCntlr import *
cs = CsCntlr()
cs.useManualSettingMode()

cs1 = CsCntlr()
cs1.useFixedPeriodMode()

# now, cs is changed to the Fixed Period Mode
print(cs.cntlr_mode)
# Fixed Period Mode

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CsCntlr-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file CsCntlr-0.1.0.tar.gz.

File metadata

  • Download URL: CsCntlr-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for CsCntlr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a70c5faf44aff5c12bebca91a12de1cfcc7ae0d054dda72b485f38de8b53a4e9
MD5 7757bf4964c48722f0679399340b9a5b
BLAKE2b-256 45662b1c09914ebbdebdbafaaeafb67fdf669688a7ff1c2fdcff54605396f50c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page