proyectos:jardin_delicias:tecnologicos:centrifugadora
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| proyectos:jardin_delicias:tecnologicos:centrifugadora [2016/05/06 22:50] – [RoboRemo] brolin | proyectos:jardin_delicias:tecnologicos:centrifugadora [2016/05/07 18:41] (actual) – brolin | ||
|---|---|---|---|
| Línea 2: | Línea 2: | ||
| ===== ESC ===== | ===== ESC ===== | ||
| + | |||
| + | http:// | ||
| + | https:// | ||
| + | http:// | ||
| ===== RoboRemo ===== | ===== RoboRemo ===== | ||
| Línea 13: | Línea 17: | ||
| https:// | https:// | ||
| + | |||
| + | < | ||
| + | wifi.setmode(wifi.SOFTAP) | ||
| + | |||
| + | cfg={} | ||
| + | cfg.ssid=" | ||
| + | cfg.pwd=" | ||
| + | |||
| + | cfg.ip=" | ||
| + | cfg.netmask=" | ||
| + | cfg.gateway=" | ||
| + | |||
| + | port = 9876 | ||
| + | |||
| + | wifi.ap.setip(cfg) | ||
| + | wifi.ap.config(cfg) | ||
| + | |||
| + | function stringStarts(a, | ||
| + | return string.sub(a, | ||
| + | end | ||
| + | |||
| + | function stringEnds(a, | ||
| + | | ||
| + | end | ||
| + | |||
| + | servo = {} | ||
| + | servo.pin = 4 --this is GPIO2 | ||
| + | servo.value = 1500 | ||
| + | servo.id = " | ||
| + | |||
| + | |||
| + | cmd = "" | ||
| + | |||
| + | gpio.mode(servo.pin, | ||
| + | gpio.write(servo.pin, | ||
| + | |||
| + | tmr.alarm(0, | ||
| + | if servo.value then -- generate pulse | ||
| + | gpio.write(servo.pin, | ||
| + | -- print(" | ||
| + | tmr.delay(servo.value) | ||
| + | gpio.write(servo.pin, | ||
| + | end | ||
| + | end) | ||
| + | | ||
| + | |||
| + | function exeCmd(st) -- example: "servo 1500" | ||
| + | if stringStarts(st, | ||
| + | servo.value = tonumber( string.sub(st, | ||
| + | end | ||
| + | end | ||
| + | |||
| + | |||
| + | function receiveData(conn, | ||
| + | cmd = cmd .. data | ||
| + | |||
| + | local a, b = string.find(cmd, | ||
| + | while a do | ||
| + | exeCmd( string.sub(cmd, | ||
| + | cmd = string.sub(cmd, | ||
| + | a, b = string.find(cmd, | ||
| + | end | ||
| + | end | ||
| + | |||
| + | |||
| + | srv=net.createServer(net.TCP, | ||
| + | srv: | ||
| + | print(" | ||
| + | conn: | ||
| + | |||
| + | conn: | ||
| + | | ||
| + | conn: | ||
| + | print(" | ||
| + | end) | ||
| + | | ||
| + | end) | ||
| + | </ | ||
| + | |||
proyectos/jardin_delicias/tecnologicos/centrifugadora.1462575036.txt.gz · Última modificación: por brolin
