Hi David,
The “None” is the print output of GPIO.output() function, because the function have no return value.
Sensors are used only as input usually, if you want to “see” the vibration, you can connect a display Grove – like Grove - Red LED to your Raspberry Pi. Suppose the Grove - Red LED connected to Raspberry Pi’s pin 3, to make LED lights up when vibration detected, the code looks like this:
[code]
import time
import RPi.GPIO as GPIO
SENSOR_PIN = 2
LED_PIN = 3
GPIO.setmode(GPIO.BCM)
GPIO.setup(SENSOR_PIN, GPIO.IN)
GPIO.setup(LED_PIN, GPIO.OUT)
while True:
if GPIO.input(SENSOR_PIN) == GPIO.HIGH:
print(“Detected”)
GPIO.output(LED_PIN, GPIO.HIGH)
else:
GPIO.output(LED_PIN, GPIO.LOW)
time.sleep(0.1)
[/code]
Best Regards,
Blu