grove.grove_thumb_joystick
¶
- This is the code for
Examples
import time
from grove.grove_thumb_joystick import GroveThumbJoystick
# connect to alalog pin 2(slot A2)
PIN = 2
sensor = GroveThumbJoystick(PIN)
while True:
x, y = sensor.value
if x > 900:
print('Joystick Pressed')
print("X, Y = {0} {1}".format(x, y))
time.sleep(.2)
Classes¶
GroveThumbJoystick
: Grove Thumb Joystick class
- class grove.grove_thumb_joystick.GroveThumbJoystick(channel)[source]¶
Grove Thumb Joystick class
- Parameters:
channel (int) – number of analog pin/channel the sensor connected.
Inheritance
digraph inheritance7fc3146802 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GroveThumbJoystick" [URL="#grove.grove_thumb_joystick.GroveThumbJoystick",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 Thumb Joystick class"]; }- property value¶
Get the water strength value
- Returns:
x-ratio, y-ratio, all are 0(0.0%) - 1000(100.0%)
- Return type:
(pair)