grove.grove_round_force_sensor
¶
- This is the code for
Examples
import time
from grove.grove_round_force_sensor import GroveRoundForceSensor
# connect to alalog pin 2(slot A2)
PIN = 2
sensor = GroveRoundForceSensor(PIN)
while True:
fsr = sensor.value
print('FSR Value: {}'.format(fsr), end='')
if fsr < 10:
print(" - No pressure")
elif fsr < 600:
print(" - Light squeeze")
else:
print(" - Big squeeze")
time.sleep(1.0)
Classes¶
GroveRoundForceSensor
: Class for Grove - Round Force Sensor
- class grove.grove_round_force_sensor.GroveRoundForceSensor(channel)[source]¶
Class for Grove - Round Force Sensor
- Parameters:
pin (int) – number of analog pin/channel the sensor connected.
Inheritance
digraph inheritance94340093ad { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ADC" [URL="grove.adc.html#grove.adc.ADC",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="Class ADC for the ADC unit on Grove Base Hat for RPi."]; "GroveRoundForceSensor" [URL="#grove.grove_round_force_sensor.GroveRoundForceSensor",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="Class for Grove - Round Force Sensor"]; "ADC" -> "GroveRoundForceSensor" [arrowsize=0.5,style="setlinewidth(0.5)"]; }- property value¶
Get the force strength value, the strengest value is 100.0%.
- Returns:
ratio, 0(0.0%) - 1000(100.0%)
- Return type:
(int)