Solenoid Engine – Raspberry Pi – Simple – Python

</p>
<p>#<br />
# Solenoid Engine Simple Script - Flat out Speed<br />
# sudo apt-get install python-rpi.gpio<br />
# python soleng.py<br />
#<br />
# Import the required module.<br />
import RPi.GPIO as GPIO</p>
<p>#define pins<br />
# WiringPi 7 = gpio 4 = pin 7<br />
NOTEYE = 7<br />
# wiringPi 0 = gpio 17 = pin 11<br />
SOL = 11</p>
<p># Set the mode of numbering the pins.<br />
GPIO.setmode(GPIO.BOARD)<br />
# GPIO pin 10 is the output.<br />
GPIO.setup(SOL, GPIO.OUT)<br />
# GPIO pin 8 is the input.<br />
GPIO.setup(NOTEYE, GPIO.IN)</p>
<p>while 1:<br />
 # if GPIO.input(NOTEYE) == 0: For V1 Engines<br />
 if GPIO.input(NOTEYE) == 1:<br />
  GPIO.output(SOL,1)<br />
 else:<br />
  GPIO.output(SOL,0)</p>
<p>