반응형 2024/04/291 [RPI] How to use Inductive Proximity Sensor with Raspberry Pi 3 Model B import timeimport RPi.GPIO as GPIO# Pin of InputGPIOpin = -1# Initial the input pindef initialInductive(pin): global GPIOpin GPIOpin = pin GPIO.setmode(GPIO.BCM) GPIO.setup(GPIOpin,GPIO.IN, pull_up_down=GPIO.PUD_DOWN) print("Finished Initiation") print(GPIOpin)# Detect Metaldef detectMetal(): if(GPIOpin != -1): state = GPIO.input(GPIOpin) if state: print("Metal Detected") e.. 2024. 4. 29. 이전 1 다음 반응형