grove.grove_sound_sensor
¶
- This is the code for
Examples
import time
from grove.grove_sound_sensor import GroveSoundSensor
# connect to alalog pin 2(slot A2)
PIN = 2
sensor = GroveSoundSensor(PIN)
print('Detecting sound...')
while True:
print('Sound value: {0}'.format(sensor.sound))
time.sleep(.3)
Classes¶
GroveSoundSensor
: Grove Sound Sensor class
- class grove.grove_sound_sensor.GroveSoundSensor(channel)[source]¶
Grove Sound Sensor class
- Parameters:
pin (int) – number of analog pin/channel the sensor connected.
Inheritance
digraph inheritance702fff3c5a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GroveSoundSensor" [URL="#grove.grove_sound_sensor.GroveSoundSensor",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 Sound Sensor class"]; }- property sound¶
Get the sound strength value
- Returns:
ratio, 0(0.0%) - 1000(100.0%)
- Return type:
(int)