コード例 #1
0
"""
Gibt die gemessenen Schalldruck in Dezibel zurück. Die Werte werden in
dB/10 (Zehntel dB) zurückgegeben.

Das Bricklet unterstützt die Gewichtungen dB(A), dB(B), dB(C), dB(D), dB(Z) und
ITU-R 468. Die Gewichtungsfunktion kann mittels :func:`Set Configuration`
gesetzt werden.

Standardmäßig wird dB(A) genutzt.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Decibel',
    data_name = 'Decibel',
    data_type = 'uint16',
    doc       = decibel_doc
)

com['packets'].append({
'type': 'function',
'name': 'Get Spectrum Low Level',
'elements': [('Spectrum Length', 'uint16', 1, 'out'),
             ('Spectrum Chunk Offset', 'uint16', 1, 'out'),
             ('Spectrum Chunk Data', 'uint16', 30, 'out')],
'high_level': {'stream_out': {'name': 'Spectrum'}},
'since_firmware': [1, 0, 0],
'doc': ['bf', {
'en':
"""
コード例 #2
0
    'de':
    """
Gibt den aktuellen Zählerwert des Encoders zurück. Wenn
reset auf true gesetzt wird, wird der Zählerstand
direkt nach dem auslesen auf 0 zurück gesetzt.

Der Encoder hat 24 Schritte pro Umdrehung.

Wenn der Encoder nach links gedreht wird wird der Zählerwert
dekrementiert, d.h. negative Zählerwerte sind möglich.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Count',
                            data_name='Count',
                            data_type='int32',
                            doc=count_doc)

com['packets'][0]['elements'].insert(0, ('Reset', 'bool', 1, 'in'))

com['packets'].append({
    'type':
    'function',
    'name':
    'Is Pressed',
    'elements': [('Pressed', 'bool', 1, 'out')],
    'since_firmware': [1, 0, 0],
    'doc': [
        'bf', {
            'en':
コード例 #3
0
weight_doc = {
'en':
"""
Returns the currently measured weight in grams.
""",
'de':
"""
Gibt das aktuell gemessene Gewicht in Gramm zurück.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Weight',
    data_name = 'Weight',
    data_type = 'int32',
    doc       = weight_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Moving Average',
'elements': [('Average', 'uint16', 1, 'in')],
'since_firmware': [1, 0, 0],
'doc': ['af', {
'en':
"""
Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
for the weight value.
コード例 #4
0
    """
Returns the temperature of the connected sensor. The value
has a range of -246 to 849 °C and is given in °C/100,
e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
""",
    'de':
    """
Gibt die Temperatur des verbundenen Sensors zurück. Der Wertebereich ist von
-246 bis 849 °C und wird in °C/100 angegeben, z.B. bedeutet
ein Wert von 4223 eine gemessene Temperatur von 42,23 °C.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Temperature',
                            data_name='Temperature',
                            data_type='int32',
                            doc=temperature_doc)

resistance_doc = {
    'en':
    """
Returns the value as measured by the MAX31865 precision delta-sigma ADC.

The value can be converted with the following formulas:

* Pt100:  resistance = (value * 390) / 32768
* Pt1000: resistance = (value * 3900) / 32768
""",
    'de':
    """
コード例 #5
0
geteilt werden, um den UVA Index zu bestimmen. Um den UV Index zu bestimmen kann
:func:`Get UVI` verwendet werden.

Falls der Sensor gesättigt (saturated) ist, dann wird -1 zurückgegeben,
siehe :func:`Set Configuration`.

Wenn die Intensität periodisch abgefragt werden soll, wird empfohlen
den :cb:`UVA` Callback zu nutzen und die Periode mit
:func:`Set UVA Callback Configuration` vorzugeben.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get UVA',
    data_name = 'UVA',
    data_type = 'int32',
    doc       = uva_doc
)

uvb_doc = {
'en':
"""
Returns the UVB intensity of the sensor, the intensity is given
in 1/10 mW/m². The sensor has not weighted the intensity with the erythemal
action spectrum to get the skin-affecting irradiation. Therefore, you cannot
just divide the value by 250 to get the UVB index. To get the UV index use
:func:`Get UVI`.

If the sensor is saturated, then -1 is returned, see :func:`Set Configuration`.
コード例 #6
0
Returns the measured air pressure. The value has a range of
260000 to 1260000 and is given in mbar/1000, i.e. a value of
1001092 means that an air pressure of 1001.092 mbar is measured.
""",
    'de':
    """
Gibt den Luftdruck des Luftdrucksensors zurück. Der Wertbereich
geht von 260000 bis 1260000 und ist in mbar/1000 angegeben, d.h.
bei einem Wert von 1001092 wurde ein Luftdruck von 1001,092 mbar
gemessen.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Air Pressure',
                            data_name='Air Pressure',
                            data_type='int32',
                            doc=air_pressure_doc)

altitude_doc = {
    'en':
    """
Returns the relative altitude of the air pressure sensor. The value
is given in mm and is calculated based on the difference between the
current air pressure and the reference air pressure that can be set
with :func:`Set Reference Air Pressure`.
""",
    'de':
    """
Gibt die relative Höhe des Luftdrucksensors zurück. Der Wert ist in
mm angegeben und wird auf Basis der Differenz zwischen dem aktuellen
コード例 #7
0
ist in nA und im Bereich von 0nA bis 22505322nA (22,5mA).

Es ist möglich zu erkennen ob ein IEC 60381-1-kompatibler Sensor angeschlossen
ist und ob er funktionsfähig ist.

Falls die zurückgegebene Stromstärke kleiner als 4mA ist, ist wahrscheinlich
kein Sensor angeschlossen oder der Sensor ist defekt. Falls die zurückgegebene
Stromstärke über 20mA ist, besteht entweder ein Kurzschluss oder der Sensor
ist defekt. Somit ist erkennbar ob ein Sensor angeschlossen und funktionsfähig
ist.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Current',
                            data_name='Current',
                            data_type='int32',
                            has_channels=True,
                            doc=current_doc)

com['packets'].append({
    'type':
    'function',
    'name':
    'Set Sample Rate',
    'elements': [('Rate', 'uint8', 1, 'in', {
        'constant_group': 'Sample Rate'
    })],
    'since_firmware': [1, 0, 0],
    'doc': [
        'af', {
            'en':
コード例 #8
0
'en':
"""
Returns the position of the linear potentiometer. The value is
between 0 (slider down) and 100 (slider up).
""",
'de':
"""
Gibt die Position des Linearpotentiometers zurück. Der Wertebereich
ist von 0 (Schieberegler unten) und 100 (Schieberegler oben).
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Position',
    data_name = 'Position',
    data_type = 'uint16',
    doc       = position_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Motor Position',
'elements': [('Position', 'uint16', 1, 'in'),
             ('Drive Mode', 'uint8', 1, 'in', ('Drive Mode', [('Fast', 0),
                                                              ('Smooth', 1)])),
             ('Hold Position', 'bool', 1, 'in')],
'since_firmware': [1, 0, 0],
'doc': ['bf', {
'en':
"""
コード例 #9
0
'de':
"""
Gibt die Temperatur des Thermoelements zurück. Der Wert wird in °C/100
angegeben, z.B. bedeutet ein Wert von 4223 eine gemessene Temperatur von
42,23 °C.

Wenn die Temperatur periodisch abgefragt werden soll, wird empfohlen
den :cb:`Temperature` Callback zu nutzen und die Periode mit
:func:`Set Temperature Callback Configuration` vorzugeben.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Temperature',
    data_name = 'Temperature',
    data_type = 'int32',
    doc       = temperature_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Configuration',
'elements': [('Averaging', 'uint8', 1, 'in', ('Averaging', [('1', 1),
                                                            ('2', 2),
                                                            ('4', 4),
                                                            ('8', 8),
                                                            ('16', 16)])),
             ('Thermocouple Type', 'uint8', 1, 'in', ('Type', [('B', 0),
                                                               ('E', 1),
                                                               ('J', 2),
コード例 #10
0
:func:`Set Config` eingestellt werden. Um die Beleuchtungsstärke in Lux zu
ermitteln muss folgende Formel angewendet werden::

 lux = illuminance * 700 / gain / integration_time

Für eine korrekte Messung der Beleuchtungsstärke muss sichergestellt
sein, dass die Farbwerte (R, G oder B) nicht saturiert sind. Ein
Farbwert ist saturiert wenn der Wert 65535 beträgt. In diesem Fall
kann die Verstärkung per :func:`Set Config` reduziert werden.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Illuminance',
    data_name = 'Illuminance',
    data_type = 'uint32',
    doc       = illuminance_doc
)

color_temperature_doc = {
'en':
"""
Returns the color temperature in Kelvin.

To get a correct color temperature measurement make sure that the color
values themself are not saturated. The color value (R, G or B)
is saturated if it is equal to the maximum value of 65535.
In that case you have to reduce the gain, see :func:`Set Config`.
""",
'de':
コード例 #11
0
geteilt werden, um den UVA Index zu bestimmen. Um den UV Index zu bestimmen kann
:func:`Get UVI` verwendet werden.

Falls der Sensor gesättigt (saturated) ist, dann wird -1 zurückgegeben,
siehe :func:`Set Configuration`.

Wenn die Intensität periodisch abgefragt werden soll, wird empfohlen
den :cb:`UVA` Callback zu nutzen und die Periode mit
:func:`Set UVA Callback Configuration` vorzugeben.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get UVA',
    data_name = 'UVA',
    data_type = 'int32',
    doc       = uva_doc
)

uvb_doc = {
'en':
"""
Returns the UVB intensity of the sensor, the intensity is given
in 1/10 mW/m². The sensor has not weighted the intensity with the erythemal
action spectrum to get the skin-affecting irradiation. Therefore, you cannot
just divide the value by 250 to get the UVB index. To get the UV index use
:func:`Get UVI`.

If the sensor is saturated, then -1 is returned, see :func:`Set Configuration`.
コード例 #12
0
'en':
"""
Returns the current. The value is in mA
and between -20000mA and 20000mA.
""",
'de':
"""
Gibt die gemessenen Stromstärke zurück. Der Wert ist in mA und im
Bereich von -20000mA bis 20000mA.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Current',
    data_name = 'Current',
    data_type = 'int32',
    doc       = current_doc
)

voltage_doc = {
'en':
"""
Returns the voltage. The value is in mV
and between 0mV and 36000mV.
""",
'de':
"""
Gibt die gemessenen Spannung zurück. Der Wert ist in mV und im
Bereich von 0mV bis 36000mV.
"""
コード例 #13
0
"""
Gibt die Beleuchtungsstärke des Umgebungslichtsensors zurück. Der Messbereich
erstreckt sich bis über 100000Lux, aber ab 64000Lux nimmt die Messgenauigkeit
ab. Die Beleuchtungsstärke ist in Lux/100 angegeben, d.h. bei einem Wert von
450000 wurde eine Beleuchtungsstärke von 4500Lux gemessen.

Eine Beleuchtungsstärke von 0Lux bedeutet, dass der Sensor gesättigt
(saturated) ist und die Konfiguration angepasst werden sollte, siehe
:func:`Set Configuration`.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Illuminance',
    data_name = 'Illuminance',
    data_type = 'uint32',
    doc       = illuminance_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Configuration',
'elements': [('Illuminance Range', 'uint8', 1, 'in', ('Illuminance Range', [('Unlimited', 6),
                                                                            ('64000Lux', 0),
                                                                            ('32000Lux', 1),
                                                                            ('16000Lux', 2),
                                                                            ('8000Lux', 3),
                                                                            ('1300Lux', 4),
                                                                            ('600Lux', 5)])),
             ('Integration Time', 'uint8', 1, 'in', ('Integration Time', [('50ms', 0),
コード例 #14
0
""",
    'de':
    """
Gibt die Umgebungstemperatur des Sensors zurück. Der Wertebereich ist von
-400 bis 1250 und wird in °C/10 angegeben, z.B. bedeutet
ein Wert von 423 eine gemessene Umgebungstemperatur von 42,3 °C.

Wenn die Umgebungstemperatur periodisch abgefragt werden soll, wird empfohlen
den :cb:`Ambient Temperature` Callback zu nutzen und die Periode mit
:func:`Set Ambient Temperature Callback Configuration` vorzugeben.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Ambient Temperature',
                            data_name='Temperature',
                            data_type='int16',
                            doc=ambient_temperature_doc)

object_temperature_doc = {
    'en':
    """
Returns the object temperature of the sensor, i.e. the temperature
of the surface of the object the sensor is aimed at. The value
has a range of -700 to 3800 and is given in °C/10,
e.g. a value of 3001 means that a temperature of 300.1 °C is measured
on the surface of the object.

The temperature of different materials is dependent on their `emissivity
<https://en.wikipedia.org/wiki/Emissivity>`__. The emissivity of the material
can be set with :func:`Set Emissivity`.
コード例 #15
0
'en':
"""
Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__
in `µT (micro Tesla) <https://en.wikipedia.org/wiki/Tesla_(unit)>`__.
""",
'de':
"""
Gibt die `magnetische Flussdichte (magnetische Induktion) <https://de.wikipedia.org/wiki/Magnetische_Flussdichte>`__
in `µT (Microtesla) <https://de.wikipedia.org/wiki/Tesla_(Einheit)>`__ zurück.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Magnetic Flux Density',
    data_name = 'Magnetic Flux Density',
    data_type = 'int16',
    doc       = magnetic_flux_density_doc
)

com['packets'].append({
'type': 'function',
'name': 'Get Counter',
'elements': [('Reset Counter', 'bool', 1, 'in'),
             ('Count', 'uint32', 1, 'out')],
'since_firmware': [1, 0, 0],
'doc': ['bf', {
'en':
"""
Returns the current value of the counter.
コード例 #16
0
temperature_doc = {
'en':
"""
Returns temperature in steps of 0.01 °C.
""",
'de':
"""
Gibt die Temperatur in 0,01 °C Schritten zurück.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Temperature',
    data_name = 'Temperature',
    data_type = 'int32',
    doc       = temperature_doc
)

humidity_doc = {
'en':
"""
Returns relative humidity in steps of 0.01 %RH.
""",
'de':
"""
Gibt die relative Luftfeuchtigkeit in 0,01 %RH Schritten zurück.
"""
}
コード例 #17
0
Returns the measured voltage. The value is in mV and
between 0V and 42V. The resolution is approximately 10mV to 1mV
depending on the oversampling configuration (:func:`Set Oversampling`).
""",
'de':
"""
Gibt die gemessene Spannung zurück. Der Wert ist in mV und im
Bereich von 0 bis 42V. Die Auflösung ca. 10mV bis 1mV abhängig von der
Überabtastungs-Konfiguration (:func:`Set Oversampling`).
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Voltage',
    data_name = 'Voltage',
    data_type = 'uint16',
    doc       = voltage_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Oversampling',
'elements': [('Oversampling', 'uint8', 1, 'in', OVERSAMPLING)],
'since_firmware': [1, 0, 0],
'doc': ['af', {
'en':
"""
Sets the oversampling between 32x and 16384x. The Bricklet
takes one 12bit sample every 17.5µs. Thus an oversampling
of 32x is equivalent to an integration time of 0.56ms and
コード例 #18
0
        'de': 'Misst Erdfeuchtigkeit'
    },
    'released': False,
    'documented': False,
    'discontinued': False,
    'features': [
        'bricklet_get_identity'
    ],
    'packets': [],
    'examples': []
}

moisture_doc = {
'en':
"""
TODO
""",
'de':
"""
TODO
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Moisture',
    data_name = 'Moisture',
    data_type = 'uint16',
    doc       = moisture_doc
)
コード例 #19
0
"""
Gibt den aktuellen Zählerwert des Encoders zurück. Wenn
reset auf true gesetzt wird, wird der Zählerstand
direkt nach dem auslesen auf 0 zurück gesetzt.

Der Encoder hat 24 Schritte pro Umdrehung.

Wenn der Encoder nach links gedreht wird wird der Zählerwert
dekrementiert, d.h. negative Zählerwerte sind möglich.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Count',
    data_name = 'Count',
    data_type = 'int32',
    doc       = count_doc
)

com['packets'][0]['elements'].insert(0, ('Reset', 'bool', 1, 'in'))

com['packets'].append({
'type': 'function',
'name': 'Is Pressed',
'elements': [('Pressed', 'bool', 1, 'out')],
'since_firmware': [1, 0, 0],
'doc': ['bf', {
'en':
"""
Returns *true* if the button is pressed and *false* otherwise.
コード例 #20
0
Alternatively you can use :func:`Get Magnetic Flux Density` and calculate the heading
with ``heading = atan2(y, x)*180/PI``.
""",
'de':
"""
Gibt die Richtung in 1/10 grad zurück (Norden = 0 Grad).

Alternativ kann die Funktion :func:`Get Magnetic Flux Density` genutzt werden um
die Richtung per ``heading = atan2(y, x)*180/PI`` zu bestimmen.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Heading',
    data_name = 'Heading',
    data_type = 'int16',
    doc       = heading_doc
)

com['packets'].append({
'type': 'function',
'name': 'Get Magnetic Flux Density',
'elements': [('X', 'int32', 1, 'out'),
             ('Y', 'int32', 1, 'out'),
             ('Z', 'int32', 1, 'out')],
'since_firmware': [1, 0, 0],
'doc': ['bf', {
'en':
"""
Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__
コード例 #21
0
Returns the distance measured by the sensor. The value is in mm and possible
distance ranges are 40 to 300, 100 to 800 and 200 to 1500, depending on the
selected IR sensor.
""",
'de':
"""
Gibt die gemessene Entfernung des Sensors zurück. Der Wert ist in mm und die möglichen
Entfernungsbereiche sind 40 bis 300, 100 bis 800 und 200 bis 1500, in Abhängigkeit vom
gewählten IR Sensor.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Distance',
    data_name = 'Distance',
    data_type = 'uint16',
    doc       = distance_doc
)

analog_value_doc = {
'en':
"""
Returns the analog value as read by a analog-to-digital converter.
The value has 21 bit with a range of 0 to 2097151.

This is unfiltered raw data. We made sure that the integration time
of the ADC is shorter then the measurement interval of the sensor
(10ms vs 16.5ms). So there is no information lost.

If you want to do your own calibration or create your own lookup table
コード例 #22
0
co2_concentration_doc = {
'en':
"""
Returns CO2 concentration in ppm.
""",
'de':
"""
Gibt die CO2-Konzentration in ppm zurück.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get CO2 Concentration',
    data_name = 'CO2 Concentration',
    data_type = 'uint16',
    doc       = co2_concentration_doc
)

temperature_doc = {
'en':
"""
Returns temperature in steps of 0.01 °C.
""",
'de':
"""
Gibt die Temperatur in 0,01 °C Schritten zurück.
"""
}
    'packets': [],
    'examples': []
}

voltage_doc = {
    'en': """
Returns the voltage for the given channel in mV.
""",
    'de': """
Gibt die Spannung für den übergebenen Kanal in mV zurück.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Voltage',
                            data_name='Voltage',
                            data_type='int32',
                            has_channels=True,
                            doc=voltage_doc)

com['packets'].append({
    'type':
    'function',
    'name':
    'Set Sample Rate',
    'elements': [('Rate', 'uint8', 1, 'in', ('Sample Rate', [('976 SPS', 0),
                                                             ('488 SPS', 1),
                                                             ('244 SPS', 2),
                                                             ('122 SPS', 3),
                                                             ('61 SPS', 4),
                                                             ('4 SPS', 5),
                                                             ('2 SPS', 6),
コード例 #24
0
    'de':
    """
Gibt die gemessenen Schalldruck in Dezibel zurück. Die Werte werden in
dB/10 (Zehntel dB) zurückgegeben.

Das Bricklet unterstützt die Gewichtungen dB(A), dB(B), dB(C), dB(D), dB(Z) und
ITU-R 468. Die Gewichtungsfunktion kann mittels :func:`Set Configuration`
gesetzt werden.

Standardmäßig wird dB(A) genutzt.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Decibel',
                            data_name='Decibel',
                            data_type='uint16',
                            doc=decibel_doc)

com['packets'].append({
    'type':
    'function',
    'name':
    'Get Spectrum Low Level',
    'elements': [('Spectrum Length', 'uint16', 1, 'out'),
                 ('Spectrum Chunk Offset', 'uint16', 1, 'out'),
                 ('Spectrum Chunk Data', 'uint16', 30, 'out')],
    'high_level': {
        'stream_out': {
            'name': 'Spectrum'
        }
コード例 #25
0
Integrationszeit zurück. Verstärkung und Integrationszeit können mit
:func:`Set Configuration` eingestellt werden. Um die Beleuchtungsstärke in Lux zu
ermitteln, muss folgende Formel angewendet werden::

 lux = illuminance * 700 / gain / integration_time

Für eine korrekte Messung der Beleuchtungsstärke muss sichergestellt
sein, dass die Farbwerte (R, G oder B) nicht saturiert sind. Ein
Farbwert ist saturiert, wenn der Wert 65535 beträgt. In diesem Fall
kann die Verstärkung per :func:`Set Configuration` reduziert werden.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Illuminance',
                            data_name='Illuminance',
                            data_type='uint32',
                            doc=illuminance_doc)

color_temperature_doc = {
    'en':
    """
Returns the color temperature in Kelvin.

To get a correct color temperature measurement make sure that the color
values themselves are not saturated. The color value (R, G or B)
is saturated if it is equal to the maximum value of 65535.
In that case you have to reduce the gain, see :func:`Set Configuration`.
""",
    'de':
    """
コード例 #26
0
'en':
"""
Returns the position of the linear potentiometer. The value is
between 0 (slider down) and 100 (slider up).
""",
'de':
"""
Gibt die Position des Linearpotentiometers zurück. Der Wertebereich
ist von 0 (Schieberegler unten) und 100 (Schieberegler oben).
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Position',
    data_name = 'Position',
    data_type = 'uint16',
    doc       = position_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Motor Position',
'elements': [('Position', 'uint16', 1, 'in'),
             ('Drive Mode', 'uint8', 1, 'in', ('Drive Mode', [('Fast', 0),
                                                              ('Smooth', 1)])),
             ('Hold Position', 'bool', 1, 'in')],
'since_firmware': [1, 0, 0],
'doc': ['bf', {
'en':
"""
コード例 #27
0
The laser has to be enabled, see :func:`Set Enable`.
""",
'de':
"""
Gibt die gemessene Distanz zurück. Der Wertebereich ist 0 bis 4000
und die Werte haben die Einheit cm.

Der Laser muss aktiviert werden, siehe :func:`Set Enable`.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Distance',
    data_name = 'Distance',
    data_type = 'int16',
    doc       = distance_doc
)

velocity_doc = {
'en':
"""
Returns the measured velocity. The value has a range of -12800 to 12700
and is given in 1/100 m/s.

The velocity measurement only produces stables results if a fixed
measurement rate (see :func:`Set Configuration`) is configured. Also the laser
has to be enabled, see :func:`Set Enable`.
""",
'de':
コード例 #28
0
magnetic_flux_density_doc = {
    'en':
    """
Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__
in `µT (micro Tesla) <https://en.wikipedia.org/wiki/Tesla_(unit)>`__.
""",
    'de':
    """
Gibt die `magnetische Flussdichte (magnetische Induktion) <https://de.wikipedia.org/wiki/Magnetische_Flussdichte>`__
in `µT (Microtesla) <https://de.wikipedia.org/wiki/Tesla_(Einheit)>`__ zurück.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Magnetic Flux Density',
                            data_name='Magnetic Flux Density',
                            data_type='int16',
                            doc=magnetic_flux_density_doc)

com['packets'].append({
    'type':
    'function',
    'name':
    'Get Counter',
    'elements': [('Reset Counter', 'bool', 1, 'in'),
                 ('Count', 'uint32', 1, 'out')],
    'since_firmware': [1, 0, 0],
    'doc': [
        'bf', {
            'en':
            """
コード例 #29
0
current_doc = {
    'en':
    """
Returns the current. The value is in mA
and between -20000mA and 20000mA.
""",
    'de':
    """
Gibt die gemessenen Stromstärke zurück. Der Wert ist in mA und im
Bereich von -20000mA bis 20000mA.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Current',
                            data_name='Current',
                            data_type='int32',
                            doc=current_doc)

voltage_doc = {
    'en':
    """
Returns the voltage. The value is in mV
and between 0mV and 36000mV.
""",
    'de':
    """
Gibt die gemessenen Spannung zurück. Der Wert ist in mV und im
Bereich von 0mV bis 36000mV.
"""
}
コード例 #30
0
    """
Returns the measured voltage. The value is in mV and
between 0V and 42V. The resolution is approximately 10mV to 1mV
depending on the oversampling configuration (:func:`Set Oversampling`).
""",
    'de':
    """
Gibt die gemessene Spannung zurück. Der Wert ist in mV und im
Bereich von 0 bis 42V. Die Auflösung ca. 10mV bis 1mV abhängig von der
Überabtastungs-Konfiguration (:func:`Set Oversampling`).
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Voltage',
                            data_name='Voltage',
                            data_type='uint16',
                            doc=voltage_doc)

com['packets'].append({
    'type':
    'function',
    'name':
    'Set Oversampling',
    'elements': [('Oversampling', 'uint8', 1, 'in', OVERSAMPLING)],
    'since_firmware': [1, 0, 0],
    'doc': [
        'af', {
            'en':
            """
Sets the oversampling between 32x and 16384x. The Bricklet
コード例 #31
0
Alternatively you can use :func:`Get Magnetic Flux Density` and calculate the
heading with ``heading = atan2(y, x) * 180 / PI``.
""",
'de':
"""
Gibt die Richtung in 1/10 Grad zurück (Norden = 0 Grad, Osten = 90 Grad).

Alternativ kann die Funktion :func:`Get Magnetic Flux Density` genutzt werden um
die Richtung per ``heading = atan2(y, x) * 180 / PI`` zu bestimmen.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Heading',
    data_name = 'Heading',
    data_type = 'int16',
    doc       = heading_doc
)

com['packets'].append({
'type': 'function',
'name': 'Get Magnetic Flux Density',
'elements': [('X', 'int32', 1, 'out'),
             ('Y', 'int32', 1, 'out'),
             ('Z', 'int32', 1, 'out')],
'since_firmware': [1, 0, 0],
'doc': ['bf', {
'en':
"""
Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__
コード例 #32
0
    'description': {
        'en': 'Measures soil moisture',
        'de': 'Misst Erdfeuchtigkeit'
    },
    'released': False,
    'documented': False,
    'discontinued': False,
    'packets': [],
    'examples': []
}

moisture_doc = {
'en':
"""
TODO
""",
'de':
"""
TODO
"""
}

add_callback_value_function(
    packets   = com['packets'], 
    name      = 'Get Moisture', 
    data_name = 'Moisture',
    data_type = 'uint16',
    doc       = moisture_doc
)

voltage_doc = {
'en':
"""
Returns the voltage for the given channel in mV.
""",
'de':
"""
Gibt die Spannung für den übergebenen Kanal in mV zurück.
"""
}

add_callback_value_function(
    packets      = com['packets'],
    name         = 'Get Voltage',
    data_name    = 'Voltage',
    data_type    = 'int32',
    has_channels = True,
    doc          = voltage_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Sample Rate',
'elements': [('Rate', 'uint8', 1, 'in', ('Sample Rate', [('976 SPS', 0),
                                                         ('488 SPS', 1),
                                                         ('244 SPS', 2),
                                                         ('122 SPS', 3),
                                                         ('61 SPS', 4),
                                                         ('4 SPS', 5),
                                                         ('2 SPS', 6),
                                                         ('1 SPS', 7)]))],
コード例 #34
0
Returns the distance measured by the sensor. The value is in mm and possible
distance ranges are 40 to 300, 100 to 800 and 200 to 1500, depending on the
selected IR sensor.
""",
'de':
"""
Gibt die gemessene Entfernung des Sensors zurück. Der Wert ist in mm und die möglichen
Entfernungsbereiche sind 40 bis 300, 100 bis 800 und 200 bis 1500, in Abhängigkeit vom
gewählten IR Sensor.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Distance',
    data_name = 'Distance',
    data_type = 'uint16',
    doc       = distance_doc
)

analog_value_doc = {
'en':
"""
Returns the analog value as read by a analog-to-digital converter.
The value has 21 bit with a range of 0 to 2097151.

This is unfiltered raw data. We made sure that the integration time
of the ADC is shorter then the measurement interval of the sensor
(10ms vs 16.5ms). So there is no information lost.

If you want to do your own calibration or create your own lookup table
コード例 #35
0
    """
Returns the humidity measured by the sensor. The value
has a range of 0 to 10000 and is given in %RH/100 (Relative Humidity),
i.e. a value of 4223 means that a humidity of 42.23 %RH is measured.
""",
    'de':
    """
Gibt die gemessene Luftfeuchtigkeit des Sensors zurück. Der Wertebereich ist von
0 bis 10000 und wird in %RH/100 angegeben (relative Luftfeuchtigkeit), z.B. bedeutet
ein Wert von 4223 eine gemessene Luftfeuchtigkeit von 42,23 %RH.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Humidity',
                            data_name='Humidity',
                            data_type='uint16',
                            doc=humidity_doc)

temperature_doc = {
    'en':
    """
Returns the temperature measured by the sensor. The value
has a range of -4000 to 16500 and is given in °C/100,
i.e. a value of 3200 means that a temperature of 32.00 °C is measured.
""",
    'de':
    """
Gibt die gemessene Temperatur des Sensors zurück. Der Wertebereich ist von
-4000 bis 16500 und wird in °C/100 angegeben, z.B. bedeutet
ein Wert von 3200 eine gemessene Temperatur von 32,00 °C.
コード例 #36
0
weight_doc = {
'en':
"""
Returns the currently measured weight in grams.
""",
'de':
"""
Gibt das aktuell gemessene Gewicht in Gramm zurück.
"""
}

add_callback_value_function(
    packets   = com['packets'],
    name      = 'Get Weight',
    data_name = 'Weight',
    data_type = 'int32',
    doc       = weight_doc
)

com['packets'].append({
'type': 'function',
'name': 'Set Moving Average',
'elements': [('Average', 'uint16', 1, 'in')],
'since_firmware': [1, 0, 0],
'doc': ['af', {
'en':
"""
Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
for the weight value.
コード例 #37
0
and is given in cm.

The laser has to be enabled, see :func:`Set Enable`.
""",
    'de':
    """
Gibt die gemessene Distanz zurück. Der Wertebereich ist 0 bis 4000
und die Werte haben die Einheit cm.

Der Laser muss aktiviert werden, siehe :func:`Set Enable`.
"""
}

add_callback_value_function(packets=com['packets'],
                            name='Get Distance',
                            data_name='Distance',
                            data_type='int16',
                            doc=distance_doc)

velocity_doc = {
    'en':
    """
Returns the measured velocity. The value has a range of -12800 to 12700
and is given in 1/100 m/s.

The velocity measurement only produces stables results if a fixed
measurement rate (see :func:`Set Configuration`) is configured. Also the laser
has to be enabled, see :func:`Set Enable`.
""",
    'de':
    """