Modify led

This commit is contained in:
DenzelChen 2020-04-30 17:39:07 +08:00
parent f14021b98a
commit edefa7fc1b
3 changed files with 6 additions and 2 deletions

View File

@ -13,7 +13,7 @@ LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
class Led: class Led:
def __init__(self): def __init__(self):
#Control the sending order of color data #Control the sending order of color data
self.ORDER = "GRB" self.ORDER = "RGB"
# Create NeoPixel object with appropriate configuration. # Create NeoPixel object with appropriate configuration.
self.strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL) self.strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
# Intialize the library (must be called once before other functions). # Intialize the library (must be called once before other functions).

View File

@ -129,6 +129,7 @@ class Server:
pass pass
def readdata(self): def readdata(self):
try:
try: try:
self.connection1,self.client_address1 = self.server_socket1.accept() self.connection1,self.client_address1 = self.server_socket1.accept()
print ("Client connection successful !") print ("Client connection successful !")
@ -143,6 +144,7 @@ class Server:
if self.tcp_Flag: if self.tcp_Flag:
self.Reset() self.Reset()
break break
print(AllData)
if len(AllData) < 5: if len(AllData) < 5:
restCmd=AllData restCmd=AllData
if restCmd=='' and self.tcp_Flag: if restCmd=='' and self.tcp_Flag:
@ -256,6 +258,8 @@ class Server:
self.send(cmd.CMD_POWER+'#'+str(ADC_Power)+'\n') self.send(cmd.CMD_POWER+'#'+str(ADC_Power)+'\n')
except: except:
pass pass
except Exception as e:
print(e)
self.StopTcpServer() self.StopTcpServer()
def sendUltrasonic(self): def sendUltrasonic(self):
if self.sonic==True: if self.sonic==True:

Binary file not shown.