grove.grove_loudness_sensor
¶
- This is the code for
Examples
import time
from grove.grove_loudness_sensor import GroveLoudnessSensor
# connect to alalog pin 2(slot A2)
PIN = 2
sensor = GroveLoudnessSensor(PIN)
print('Detecting loud...')
while True:
value = sensor.value
if value > 10:
print("Loud value {}, Loud Detected.".format(value))
time.sleep(.5)
Classes¶
GroveLoudnessSensor
: Grove Loudness Sensor class
- class grove.grove_loudness_sensor.GroveLoudnessSensor(channel)[source]¶
Grove Loudness Sensor class
- Parameters:
pin (int) – number of analog pin/channel the sensor connected.
Inheritance
digraph inheritance5dc8dcbd6d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GroveLoudnessSensor" [URL="#grove.grove_loudness_sensor.GroveLoudnessSensor",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Grove Loudness Sensor class"]; }- property value¶
Get the loudness strength value, maximum value is 100.0%
- Returns:
ratio, 0(0.0%) - 1000(100.0%)
- Return type:
(int)