WSL2 still does not support USB devices, but with a little effort we can make possible to flash and monitor ESP device from WSL2.
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 username = 'ADAFRUIT_IO_USERNAME' | |
local aioKey = 'ADAFRUIT_IO_KEY' | |
local feed = 'ADAFRUIT_IO_MQTT_FEED_NAME' | |
local sda = 26 | |
local scl = 27 | |
local sla = 0x3c | |
i2c.setup(i2c.HW0, sda, scl, i2c.FAST) | |
local disp = u8g2.ssd1306_i2c_128x64_noname(i2c.HW0, sla) |
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
var mqtt = require('mqtt'); | |
var client = mqtt.connect('mqtt://io.adafruit.com', { | |
username: 'ADAFRUIT_IO_USERNAME', | |
password: 'ADAFRUIT_UI_KEY' | |
}); | |
var ssd1306topic = `${client.options.username}/f/ssd1306`; | |
client.on('connect', function() { |
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
substitutions: | |
device_name: humidifier | |
device_name_verbose: Humidifier | |
esp8266: | |
board: d1_mini | |
esphome: | |
name: ${device_name} |
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 function init_ws() | |
require('ws32_client') | |
.on('receive', function(data, ws) | |
print('WS received: ', data) | |
end) | |
.on('connection', function(ws) | |
print('WS connected') | |
local timer = tmr.create() |
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
const app = require('express')(); | |
const appWs = require('express-ws')(app); | |
app.ws('/echo', ws => { | |
ws.on('message', msg => { | |
console.log('Received: ', msg); | |
ws.send(msg); | |
}); | |
}); |
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
using SimpleHttp; | |
using System.Threading; | |
namespace SimpleHttpDemo | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Route.Add("/", (req, res, props) => |
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, |
NewerOlder