Tutorial
Table Of Contents
- 1. Premise
- 2. Raspberry Pi System Installation and Developmen
- 3 Log In to The Raspberry Pi and Install The App
- 4 Assembly and Precautions
- 5 Controlling Robot via WEB App
- 6 Common Problems and Solutions(Q&A)
- 7 Set The Program to Start Automatically
- 8 Remote Operation of Raspberry Pi Via MobaXterm
- 9 How to Control WS2812 RGB LED
- 10 How to Control The Servo
- 11 How to Control DC Motor
- 12 Ultrasonic Module
- 13 Line Tracking
- 14 Make A Police Light or Breathing Light
- 15 Real-Time Video Transmission
- 16 Automatic Obstacle Avoidance
- 17 Why OpenCV Uses Multi-threading to Process Vide
- 18 OpenCV Learn to Use OpenCV
- 19 Using OpenCV to Realize Color Recognition and T
- 20 Machine Line Tracking Based on OpenCV
- 21 Create A WiFi Hotspot on The Raspberry Pi
- 22 Install GUI Dependent Item under Window
- 23 How to Use GUI
- 24 Control The WS2812 LED via GUI
- 25 Real-time Video Transmission Based on OpenCV
- 26 Use OpenCV to Process Video Frames on The PC
- 27 Enable UART
- 28 Control Your AWR with An Android Device
- Conclusion
110
tcpSerSock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)
'''
Start listening to the client connection, after the client connection is successful, start to receive the information sent
from the client
'''
tcpCliSock, addr = tcpSerSock.accept()
while True:
data = ''
'''
Receive information from the client
'''
data = str(tcpCliSock.recv(BUFSIZ).decode())
if not data:
continue
'''
Turn on the light if the information content is on
If the information content is off, turn off the light
'''
elif 'on' == data:
for i in range(strip.numPixels()):
strip.setPixelColor(i, Color(255, 0, 255))
strip.show()
elif 'off' == data:
for i in range(strip.numPixels()):
strip.setPixelColor(i, Color(0, 0, 0))
strip.show()
'''
Finally print out the received data and start to continue listening to the next message from the client
'''
print(data)
●The program of the client in the PC is as follows:
'''
Import socket library to be used for TCP communication
'''
from socket import *