Reprint please indicate the source, thank you.
Raspberry Pie provides the Python language implementation of the Gpio control pack, detailed description of the visible http://maxembedded.com/2014/07/using-raspberry-pi-gpio-using-python/#PinConfig. First in the system to open the terminal to perform Python check whether the Python and Python version is installed 2 or 3, this article uses the python3.4 implementation. After checking the installation state of Python, this article uses the online installation method, download decompression installation Gpio module mode is not detailed, see the above Web site. Perform the sudo apt-get install python-rpi.gpio python3-rpi.gpio to download the Rpi.gpio module used by the raspberry pie.
The raspberry pie uses the python3.4 IDE to perform sudo python3 server.py
Design objective: Using PIN11 and Pin12 respectively control two lights, pin11 the negative of the blue led, Pin12 connect the cathode of the red Ledd, Pin1 connect the blue and red cathode, connect the way as shown:
First start in the Raspberry pie run the server program, the implementation of sudo python server.py, you need to modify the code in the IP address for the raspberry sent IP address, the port number arbitrary, if prompted socket to create failure, please replace the port number try again.
The Android side is written with the following interface:
The first input box input raspberry IP address and port number, separated by semicolons, click the Connect button will automatically connect to, click on the bottom 4 buttons will be lit red LED, green LED, flash red LED, Green LED.
Effect Chart: