7
# Connect the Grove MOSFET to analog port D6
# SIG,NC,VCC,GND
mosfet = 6
grovepi.pinMode(mosfet,"OUTPUT")
time.sleep(1)
while True:
try:
# Full speed
grovepi.analogWrite(mosfet,255)
print "full speed"
time.sleep(2)
# Half speed
grovepi.analogWrite(mosfet,128)
print "half speed"
time.sleep(2)
# Off
grovepi.analogWrite(mosfet,0)
print "off"
time.sleep(2)
except KeyboardInterrupt:
grovepi.analogWrite(mosfet,0)
break
except IOError:
print "Error"
5. Run the demo.
sudo python grove_mosfet.py
Содержание Grove MOSFET
Страница 2: ...2 Document Revision History Revision Date Author Description 1 0 Sep 22 2015 Jiankai li Create file ...
Страница 6: ...3 2 Specification Working voltage 5V Vin 5 15V MOSFET Model CJQ4435 ...
Страница 7: ...4 3 Interface Vin accepts 5V 15V power of which current is less than 2A Vout attach actuators here ...
Страница 11: ...8 5 Resource Grove MOSFET Eagle File CJQ4435 Datasheet MOSFET_WIKI Getting started with Arduino ...