In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to use raspberry pie to control gesture sensor PAJ7620, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Module description
PAJ7620 sensor is an internal integrated optical array sensor of original phase technology (Pixart) to output complex gestures and cursor patterns. it integrates nine kinds of gesture recognition: top, bottom, left, right, forward, backward, clockwise, counterclockwise and waving gesture recognition, and the module communicates with i2C. The sensor function is very powerful, and the data manual can be described in more detail.
Hardware connection
VCC-> Pin1
GND-> Pin6
SDA-> Pin3
SCL-> Pin5
INT-> currently uses the query method, but does not answer.
Software implementation #! / usr/bin/env python## GrovePi Library for using the Grove-Gesture Sensor v1.0 (http://www.seeedstudio.com/depot/Grove-Gesture-p-2463.html)## The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi## Have a question about this library? Ask on the forums here: http://forum.dexterindustries.com/c/grovepi## History#-# Author Date Comments# Karan 31 Dec 15 Initial Authoring# Lambor 11 July 18 Use smbus2## Code derived from The basic Arduino library for the Gesture Sensor by Seeed: https://github.com/Seeed-Studio/Gesture_PAJ7620'''## LicenseThe MIT License (MIT) GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.Copyright (C) 2017 Dexter IndustriesPermission is hereby granted Free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.'''import time Sysimport RPi.GPIO as GPIO#from grove.i2c import Busfrom smbus import SMBus# use the bus that matches your raspi versionrev = GPIO.RPI_REVISIONif rev = = 2 or rev = = 3: bus = SMBus (1) # bus = Bus (1) else: bus = SMBus (0) # bus = Bus (0) class gesture: # Registers and variables for the gesture sensor GES_REACTION_TIME = .500 # You can adjust the reaction time according to the actual circumstance. GES_ENTRY_TIME = .800 # When you want to recognize the Forward/Backward gestures, your gestures' reaction time must less than GES_ENTRY_TIME (0.8s). GES_QUIT_TIME = 1.000 BANK0 = 0 BANK1 = 1 PAJ7620_ADDR_BASE = 0x00 # REGISTER BANK SELECT PAJ7620_REGITER_BANK_SEL = (PAJ7620_ADDR_BASE + 0xEF) # W # DEVICE ID PAJ7620_ID = 0x73 # REGISTER BANK0 PAJ7620_ADDR_SUSPEND_CMD = (PAJ7620_ADDR_BASE + 0x3) # W PAJ7620_ADDR_GES_PS_DET_MASK_0 = (PAJ7620_ADDR_BASE + 0x41) # RW PAJ7620_ADDR_GES_PS_DET_MASK_1 = (PAJ7620_ADDR_BASE + 0x42) # RW PAJ7620_ADDR_GES_PS_DET_FLAG_0 = (PAJ7620_ADDR_BASE + 0x43) # R PAJ7620_ADDR_GES_PS_DET _ FLAG_1 = (PAJ7620_ADDR_BASE + 0x44) # R PAJ7620_ADDR_STATE_INDICATOR = (PAJ7620_ADDR_BASE + 0x45) # R PAJ7620_ADDR_PS_HIGH_THRESHOLD = (PAJ7620_ADDR_BASE + 0x69) # RW PAJ7620_ADDR_PS_LOW_THRESHOLD = (PAJ7620_ADDR_BASE + 0x6A) # RW PAJ7620_ADDR_PS_APPROACH_STATE = (PAJ7620_ADDR_BASE + 0x6B) # R PAJ7620_ADDR_PS_RAW_DATA = (PAJ7620_ADDR_BASE + 0x6C) # R # REGISTER BANK 1 PAJ7620_ADDR_PS_GAIN = (PAJ7620_ADDR_BASE + 0x44) # RW PAJ7620_ADDR_IDLE_S1_STEP_0 = (PAJ7620_ADDR_BASE + 0x67) # RW PAJ7620_ADDR_IDLE_S1_STEP_1 = (PAJ7620_ADDR_BASE + 0x68) # RW PAJ7620_ADDR_IDLE_S2_STEP_0 = (PAJ7620_ADDR_BASE + 0x69) # RW PAJ7620_ADDR_IDLE_S2_STEP_1 = (PAJ7620_ADDR_BASE + 0x6A) # RW PAJ7620_ADDR_OP_TO_S1_STEP_0 = (PAJ7620_ADDR_BASE + 0x6B) # RW PAJ7620_ADDR_OP_TO_S1_STEP_1 = (PAJ7620_ADDR_BASE + 0x6C) # RW PAJ7620_ADDR_OP_TO_S2_STEP_0 = (PAJ7620_ADDR_BASE + 0x6D) # RW PAJ7620_ADDR_OP_TO_S2_STEP_1 = (PAJ7620_ADDR_BASE + 0x6E) # RW PAJ7620_ADDR_OPERATION_ENABLE = (PAJ7620_ADDR_BASE + 0x72) # RW # PAJ7620_REGITER_BANK_SEL PAJ7620_BANK0=0 PAJ7620_BANK1=1 # PAJ7620_ADDR_SUSPEND_CMD PAJ7620_I2C_WAKEUP = 1 PAJ7620_I2C_SUSPEND = 0 # PAJ7620_ADDR_OPERATION_ENABLE PAJ7620_ENABLE=1 PAJ7620_DISABLE=0 # ADC Delete REG_ADDR_RESULT = 0x00 REG_ADDR_ALERT = 0x01 REG_ADDR_CONFIG = 0x02 REG_ADDR_LIMITL = 0x03 REG_ADDR_LIMITH = 0x04 REG_ADDR_HYST = 0x05 REG_ADDR_CONVL = 0x06 REG_ADDR_CONVH = 0x07 GES_RIGHT_FLAG = 1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.