Created
November 16, 2019 21:10
-
-
Save abobija/3092d4228416adfe1f701bbf8f549cd9 to your computer and use it in GitHub Desktop.
Code written for ESP32 in YouTube video https://youtu.be/b6W0ps3IhzA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local rfidmod = nil | |
local function init_rfid() | |
if rfidmod ~= nil then | |
return | |
end | |
rfidmod = require('rfid32')({ | |
pin_sda = 22, | |
pin_clk = 19, | |
pin_miso = 25, | |
pin_mosi = 23 | |
}) | |
.init() | |
.scan({ | |
got_tag = function(tag, rfid) | |
http.post( | |
'http://192.168.0.104:1337/log', | |
{}, | |
'{ "Tag": "' .. tag.hex() .. '" }', | |
function(code, data) | |
print(code, data) | |
end | |
) | |
end | |
}) | |
end | |
wifi.mode(wifi.STATION) | |
wifi.sta.config({ | |
ssid = 'Renault 1.9D', | |
pwd = 'renault19', | |
auto = false | |
}) | |
wifi.sta.on('got_ip', init_rfid) | |
wifi.start() | |
wifi.sta.connect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment