建立Footprint Library
擁有自己Footprint Library很重要, 因為Footprint 涉及PCB board製造, 對於自己常用的IC用料, 你可以很快且很放心的使用你專屬的footprint,這樣做PCB板的速度才會比別人快。
------------------------- ------------ ---------------
Rapsberry Pi UDP Socket | <==>|ESP8266 tx | ----> | rx motoduino|
| | rx | <---- | tx |
------------------------- ------------- ---------------
print("ESP8266 START")
ssid = "My_AP"
passwd = "12345678"
scratch_ip = "192.168.0.1"
scratch_port = 12345
wifi.setmode(wifi.STATION)
wifi.sta.config(ssid,passwd,1)
tmr.alarm(1,1000, 1, function()
if wifi.sta.getip()==nil then
print(" Wait to IP address! for " .. ssid)
else
print("New IP address is "..wifi.sta.getip())
tmr.stop(1)
sck = net.createConnection(net.UDP)
sck:on('receive', function(sck,pl) uart.write(0,pl) end)
uart.on('data',0, function(data) sck:send(data) end,0)
sck:connect(scratch_port,scratch_ip)
sck:send("START UART Tunnel\n")
uart.setup(0,38400,8,0,1,0)
end
end)
print(wifi.sta.getip())
#!/usr/bin/env python3
import socket
def s4aDecode(data):
dev_id = (data[0] & 0b01111000) >> 3
dev_val = ((data[0] & 0b00000111 ) << 7) | (data[1] & 0b01111111)
return (dev_id, dev_val)
def handle_data(data):
i= 0
length = len(data)
if(data[i] & 0b10000000):
pass
else:
i+=1
while(i<length):
try:
print(s4aDecode(data[i:i+2]))
i+=2
except:
break
address = ('',12345)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(address)
while(True):
print('--')
data, addr = s.recvfrom(1024)
handle_data(data)