removed nodemcu firmware (no longer used)
This commit is contained in:
parent
b968dbe03c
commit
8484264a65
|
@ -1,2 +0,0 @@
|
|||
esptool.py --port /dev/ttyUSB0 write_flash -fm qio 0x00000 nodemcu-master-9-modules-2019-04-08-19-43-38-float.bin
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
dofile('motor.lua')
|
||||
|
||||
cfg={}
|
||||
cfg.ssid="robot-1"
|
||||
cfg.pwd="roborally"
|
||||
wifi.ap.config(cfg)
|
||||
|
||||
sv = net.createServer()
|
||||
|
||||
Peer = {}
|
||||
function Peer:create(sck)
|
||||
local peer = {}
|
||||
setmetatable(peer, Peer)
|
||||
peer.buffer = {}
|
||||
return peer
|
||||
end
|
||||
function Peer:receive(sck, data)
|
||||
self.buffer = self.buffer .. data
|
||||
if #self.buffer >= 4 then
|
||||
dir = string.byte(self.buffer,1)
|
||||
if dir > 127 then dir = -256+dir end
|
||||
motor_dir(1, dir)
|
||||
|
||||
dir = string.byte(self.buffer,2)
|
||||
if dir > 127 then dir = -256+dir end
|
||||
motor_dir(2, dir)
|
||||
|
||||
delay = string.byte(self.buffer,3) * 256 + string.byte(self.buffer, 4)
|
||||
tmr.delay(delay)
|
||||
|
||||
motor_dir(1, 0)
|
||||
motor_dir(2, 0)
|
||||
self.buffer = {}
|
||||
sck:close()
|
||||
end
|
||||
end
|
||||
|
||||
if sv then
|
||||
-- listen to port 80 and call callback function if data is received
|
||||
sv:listen(80,
|
||||
function(conn)
|
||||
peer = Peer:create(conn)
|
||||
conn:on("receive", peer:receive(conn))
|
||||
conn:send("robot-1 at your service")
|
||||
end)
|
||||
end
|
|
@ -1,28 +0,0 @@
|
|||
motor = {}
|
||||
motor[1] = {}
|
||||
motor[1][1] = 0
|
||||
motor[1][2] = 1
|
||||
motor[1][3] = 2
|
||||
|
||||
motor[2] = {}
|
||||
motor[2][1] = 3
|
||||
motor[2][2] = 4
|
||||
motor[2][3] = 5
|
||||
|
||||
for i,m in ipairs(motor) do
|
||||
for i,g in ipairs(m) do
|
||||
gpio.mode(g, gpio.OUTPUT)
|
||||
gpio.write(g, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function motor_dir(m, dir)
|
||||
if dir ~= 0 then
|
||||
gpio.write(motor[m][3], 1)
|
||||
gpio.write(motor[m][1], (1-dir)/2)
|
||||
gpio.write(motor[m][2], (1+dir)/2)
|
||||
else
|
||||
gpio.write(motor[m][3], 0)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
motor = {}
|
||||
motor[1] = {}
|
||||
motor[1][1] = 0
|
||||
motor[1][2] = 1
|
||||
motor[1][3] = 2
|
||||
|
||||
motor[2] = {}
|
||||
motor[2][1] = 3
|
||||
motor[2][2] = 4
|
||||
motor[2][3] = 5
|
||||
|
||||
for i,m in ipairs(motor) do
|
||||
for i,g in ipairs(m) do
|
||||
gpio.mode(g, gpio.OUTPUT)
|
||||
gpio.write(g, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function motor_dir(m, dir)
|
||||
if dir ~= 0 then
|
||||
gpio.write(motor[m][3], 1)
|
||||
gpio.write(motor[m][1], (1-dir)/2)
|
||||
gpio.write(motor[m][2], (1+dir)/2)
|
||||
else
|
||||
gpio.write(motor[m][3], 0)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
motor = {}
|
||||
motor[1] = {}
|
||||
motor[1][1] = 0
|
||||
motor[1][2] = 1
|
||||
motor[1][3] = 2
|
||||
|
||||
motor[2] = {}
|
||||
motor[2][1] = 3
|
||||
motor[2][2] = 4
|
||||
motor[2][3] = 5
|
||||
|
||||
for i,m in ipairs(motor) do
|
||||
for i,g in ipairs(m) do
|
||||
gpio.mode(g, gpio.OUTPUT)
|
||||
gpio.write(g, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function motor_dir(m, dir)
|
||||
if dir ~= 0 then
|
||||
gpio.write(motor[m][3], 1)
|
||||
gpio.write(motor[m][1], (1-dir)/2)
|
||||
gpio.write(motor[m][2], (1+dir)/2)
|
||||
else
|
||||
gpio.write(motor[m][3], 0)
|
||||
end
|
||||
end
|
||||
|
||||
Peer = {}
|
||||
function Peer:create(sck)
|
||||
local peer = {}
|
||||
setmetatable(peer, Peer)
|
||||
peer.buffer = {}
|
||||
return peer
|
||||
end
|
||||
function Peer:receive(sck, data)
|
||||
self.buffer = self.buffer .. data
|
||||
if #self.buffer >= 4 then
|
||||
|
||||
sck:close()
|
||||
end
|
||||
end
|
||||
|
||||
function(conn)
|
||||
peer = Peer:create(conn)
|
||||
conn:on("receive", peer:receive)
|
||||
end
|
Binary file not shown.
Binary file not shown.
|
@ -1,12 +0,0 @@
|
|||
# flashing firmware onto NodeMCU
|
||||
esptool.py --port /dev/ttyUSB0 write_flash -fm qio 0x00000 nodemcu-master-9-modules-2019-04-08-19-43-38-float.bin
|
||||
|
||||
# connecting to NodeMCU via serial terminal
|
||||
cu -l /dev/ttyUSB0 -s 115200 dir
|
||||
|
||||
# uploading code to NodeMCU
|
||||
nodemcu-uploader upload motor.lua
|
||||
nodemcu-uploader upload init.lua
|
||||
|
||||
# sending data over wifi via socket
|
||||
nc 192.168.4.1 80
|
|
@ -1 +0,0 @@
|
|||
cu -l /dev/ttyUSB0 -s 115200 dir
|
|
@ -1,2 +0,0 @@
|
|||
nodemcu-uploader upload motor.lua
|
||||
nodemcu-uploader upload init.lua
|
|
@ -1,9 +0,0 @@
|
|||
https://hackaday.com/2016/06/14/hackaday-prize-entry-micro-robots-for-education/
|
||||
|
||||
https://www.adafruit.com/product/3216
|
||||
|
||||
https://www.exp-tech.de/plattformen/robotik/roboterfahrzeuge/7673/adafruit-mini-round-robot-chassis-kit-2wd-with-dc-motors?gclid=EAIaIQobChMIrpHIq4Ke4QIVSeAYCh0LTgdWEAQYCCABEgIQcfD_BwE
|
||||
|
||||
https://www.exp-tech.de/plattformen/robotik/roboterfahrzeuge/7898/adafruit-mini-3-layer-round-robot-chassis-kit-2wd-with-dc-motors?gclid=EAIaIQobChMIrpHIq4Ke4QIVSeAYCh0LTgdWEAQYCyABEgI76vD_BwE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user