diff --git a/.gitignore b/.gitignore index 6fd0a37..5abb575 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +Tools* +.DS_Store + # Compiled Lua sources luac.out diff --git "a/Documentation/Icon\r" "b/Documentation/Icon\r" new file mode 100644 index 0000000..e69de29 diff --git a/Documentation/NODEMCU_DEVKIT_V1.0.PDF b/Documentation/NODEMCU_DEVKIT_V1.0.PDF new file mode 100644 index 0000000..280f185 Binary files /dev/null and b/Documentation/NODEMCU_DEVKIT_V1.0.PDF differ diff --git a/Documentation/l293dd.pdf b/Documentation/l293dd.pdf new file mode 100644 index 0000000..255ce62 Binary files /dev/null and b/Documentation/l293dd.pdf differ diff --git a/Documentation/user-mannual-for-esp-12e-motor-shield.pdf b/Documentation/user-mannual-for-esp-12e-motor-shield.pdf new file mode 100644 index 0000000..d1cef38 Binary files /dev/null and b/Documentation/user-mannual-for-esp-12e-motor-shield.pdf differ diff --git "a/Firmware/Icon\r" "b/Firmware/Icon\r" new file mode 100644 index 0000000..e69de29 diff --git a/Firmware/nodemcu-master-13-modules-2018-07-11-14-45-04-float.bin b/Firmware/nodemcu-master-13-modules-2018-07-11-14-45-04-float.bin new file mode 100644 index 0000000..bf42dc9 Binary files /dev/null and b/Firmware/nodemcu-master-13-modules-2018-07-11-14-45-04-float.bin differ diff --git a/Firmware/nodemcu-master-13-modules-2018-07-11-14-45-04-integer.bin b/Firmware/nodemcu-master-13-modules-2018-07-11-14-45-04-integer.bin new file mode 100644 index 0000000..066c69f Binary files /dev/null and b/Firmware/nodemcu-master-13-modules-2018-07-11-14-45-04-integer.bin differ diff --git a/Firmware/nodemcu-master-17-modules-2018-07-12-07-10-01-float.bin b/Firmware/nodemcu-master-17-modules-2018-07-12-07-10-01-float.bin new file mode 100644 index 0000000..7aedb6a Binary files /dev/null and b/Firmware/nodemcu-master-17-modules-2018-07-12-07-10-01-float.bin differ diff --git a/Firmware/nodemcu-master-17-modules-2018-07-12-07-10-01-integer.bin b/Firmware/nodemcu-master-17-modules-2018-07-12-07-10-01-integer.bin new file mode 100644 index 0000000..3826294 Binary files /dev/null and b/Firmware/nodemcu-master-17-modules-2018-07-12-07-10-01-integer.bin differ diff --git a/Firmware/nodemcu-master-21-modules-2018-07-14-14-34-12-float.bin b/Firmware/nodemcu-master-21-modules-2018-07-14-14-34-12-float.bin new file mode 100644 index 0000000..fd6a48b Binary files /dev/null and b/Firmware/nodemcu-master-21-modules-2018-07-14-14-34-12-float.bin differ diff --git a/Firmware/nodemcu-master-21-modules-2018-07-14-14-34-12-integer.bin b/Firmware/nodemcu-master-21-modules-2018-07-14-14-34-12-integer.bin new file mode 100644 index 0000000..951e31d Binary files /dev/null and b/Firmware/nodemcu-master-21-modules-2018-07-14-14-34-12-integer.bin differ diff --git a/Firmware/nodemcu-master-25-modules-2018-07-16-08-14-30-float.bin b/Firmware/nodemcu-master-25-modules-2018-07-16-08-14-30-float.bin new file mode 100644 index 0000000..662ab71 Binary files /dev/null and b/Firmware/nodemcu-master-25-modules-2018-07-16-08-14-30-float.bin differ diff --git a/Firmware/nodemcu-master-25-modules-2018-07-16-08-14-30-integer.bin b/Firmware/nodemcu-master-25-modules-2018-07-16-08-14-30-integer.bin new file mode 100644 index 0000000..5444358 Binary files /dev/null and b/Firmware/nodemcu-master-25-modules-2018-07-16-08-14-30-integer.bin differ diff --git a/Firmware/nodemcu-master-7-modules-2018-07-09-09-44-57-float.bin b/Firmware/nodemcu-master-7-modules-2018-07-09-09-44-57-float.bin new file mode 100644 index 0000000..962af9f Binary files /dev/null and b/Firmware/nodemcu-master-7-modules-2018-07-09-09-44-57-float.bin differ diff --git a/Firmware/nodemcu-master-7-modules-2018-07-09-09-44-57-integer.bin b/Firmware/nodemcu-master-7-modules-2018-07-09-09-44-57-integer.bin new file mode 100644 index 0000000..41a8857 Binary files /dev/null and b/Firmware/nodemcu-master-7-modules-2018-07-09-09-44-57-integer.bin differ diff --git "a/Oldies/Icon\r" "b/Oldies/Icon\r" new file mode 100644 index 0000000..e69de29 diff --git a/Robot_Lua/Capture d’écran 2018-07-11 à 17.19.47.png b/Robot_Lua/Capture d’écran 2018-07-11 à 17.19.47.png new file mode 100644 index 0000000..13990ce Binary files /dev/null and b/Robot_Lua/Capture d’écran 2018-07-11 à 17.19.47.png differ diff --git a/Robot_Lua/Capture d’écran 2018-07-11 à 17.21.06.png b/Robot_Lua/Capture d’écran 2018-07-11 à 17.21.06.png new file mode 100644 index 0000000..bd36584 Binary files /dev/null and b/Robot_Lua/Capture d’écran 2018-07-11 à 17.21.06.png differ diff --git "a/Robot_Lua/Icon\r" "b/Robot_Lua/Icon\r" new file mode 100644 index 0000000..e69de29 diff --git a/Robot_Lua/t1.dxf b/Robot_Lua/t1.dxf new file mode 100644 index 0000000..f864d6b --- /dev/null +++ b/Robot_Lua/t1.dxf @@ -0,0 +1,388 @@ +0 +SECTION +2 +HEADER +9 +$INSUNITS +70 +4 +9 +$ACADVER +1 +AC1014 +9 +$HANDSEED +5 +FFFF +0 +ENDSEC +0 +SECTION +2 +TABLES +0 +TABLE +2 +VPORT +5 +8 +100 +AcDbSymbolTable +0 +ENDTAB +0 +TABLE +2 +LTYPE +5 +5 +100 +AcDbSymbolTable +0 +LTYPE +5 +14 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +2 +BYBLOCK +70 +0 +0 +LTYPE +5 +15 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord +2 +BYLAYER +70 +0 +0 +ENDTAB +0 +TABLE +2 +LAYER +5 +2 +100 +AcDbSymbolTable +70 +2 +0 +LAYER +5 +50 +100 +AcDbSymbolTableRecord +100 +AcDbLayerTableRecord +2 +0 +70 +0 +6 +CONTINUOUS +0 +ENDTAB +0 +TABLE +2 +STYLE +5 +3 +100 +AcDbSymbolTable +70 +1 +0 +STYLE +5 +11 +100 +AcDbSymbolTableRecord +100 +AcDbTextStyleTableRecord +2 +STANDARD +70 +0 +0 +ENDTAB +0 +TABLE +2 +VIEW +5 +6 +100 +AcDbSymbolTable +70 +0 +0 +ENDTAB +0 +TABLE +2 +UCS +5 +7 +100 +AcDbSymbolTable +70 +0 +0 +ENDTAB +0 +TABLE +2 +APPID +5 +9 +100 +AcDbSymbolTable +70 +2 +0 +APPID +5 +12 +100 +AcDbSymbolTableRecord +100 +AcDbRegAppTableRecord +2 +ACAD +70 +0 +0 +ENDTAB +0 +TABLE +2 +DIMSTYLE +5 +A +100 +AcDbSymbolTable +70 +1 +0 +ENDTAB +0 +TABLE +2 +BLOCK_RECORD +5 +1 +100 +AcDbSymbolTable +70 +1 +0 +BLOCK_RECORD +5 +1F +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord +2 +*MODEL_SPACE +0 +BLOCK_RECORD +5 +1B +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord +2 +*PAPER_SPACE +0 +ENDTAB +0 +ENDSEC +0 +SECTION +2 +BLOCKS +0 +BLOCK +5 +20 +100 +AcDbEntity +100 +AcDbBlockBegin +2 +*MODEL_SPACE +0 +ENDBLK +5 +21 +100 +AcDbEntity +100 +AcDbBlockEnd +0 +BLOCK +5 +1C +100 +AcDbEntity +100 +AcDbBlockBegin +2 +*PAPER_SPACE +0 +ENDBLK +5 +1D +100 +AcDbEntity +100 +AcDbBlockEnd +0 +ENDSEC +0 +SECTION +2 +ENTITIES +0 +CIRCLE +5 +100 +100 +AcDbEntity +8 +0 +100 +AcDbCircle +10 +-45 +20 +20 +30 +0 +40 +4.0000000000000036 +0 +CIRCLE +5 +101 +100 +AcDbEntity +8 +0 +100 +AcDbCircle +10 +45 +20 +20 +30 +0 +40 +4.0000000000000036 +0 +LWPOLYLINE +5 +102 +100 +AcDbEntity +8 +0 +100 +AcDbPolyline +90 +8 +70 +1 +43 +0.0 +10 +-93.674969975975969 +20 +35.000000000000021 +42 +-0.69388866648871095 +10 +93.674969975975984 +20 +34.999999999999972 +10 +64.999999417074449 +20 +35 +10 +65 +20 +-35 +10 +93.674969975975984 +20 +-34.999999999999993 +42 +-0.69388866648871095 +10 +-93.674969975975984 +20 +-35 +10 +-65 +20 +-35 +10 +-65 +20 +35 +0 +ENDSEC +0 +SECTION +2 +OBJECTS +0 +DICTIONARY +5 +C +100 +AcDbDictionary +3 +ACAD_GROUP +350 +D +3 +ACAD_MLINESTYLE +350 +17 +0 +DICTIONARY +5 +D +100 +AcDbDictionary +0 +DICTIONARY +5 +1A +330 +C +100 +AcDbDictionary +0 +DICTIONARY +5 +17 +100 +AcDbDictionary +0 +ENDSEC +0 +EOF diff --git a/Robot_Lua/t2.dxf b/Robot_Lua/t2.dxf new file mode 100644 index 0000000..b72d9c9 --- /dev/null +++ b/Robot_Lua/t2.dxf @@ -0,0 +1,1756 @@ + 0 +SECTION + 2 +HEADER + 9 +$ACADVER + 1 +AC1014 + 9 +$HANDSEED + 5 +FFFF + 9 +$MEASUREMENT + 70 + 1 + 0 +ENDSEC + 0 +SECTION + 2 +TABLES + 0 +TABLE + 2 +VPORT + 5 +8 +330 +0 +100 +AcDbSymbolTable + 70 + 4 + 0 +VPORT + 5 +2E +330 +8 +100 +AcDbSymbolTableRecord +100 +AcDbViewportTableRecord + 2 +*ACTIVE + 70 + 0 + 10 +0.0 + 20 +0.0 + 11 +1.0 + 21 +1.0 + 12 +210.0 + 22 +148.5 + 13 +0.0 + 23 +0.0 + 14 +10.0 + 24 +10.0 + 15 +10.0 + 25 +10.0 + 16 +0.0 + 26 +0.0 + 36 +1.0 + 17 +0.0 + 27 +0.0 + 37 +0.0 + 40 +341.0 + 41 +1.24 + 42 +50.0 + 43 +0.0 + 44 +0.0 + 50 +0.0 + 51 +0.0 + 71 + 0 + 72 + 100 + 73 + 1 + 74 + 3 + 75 + 0 + 76 + 0 + 77 + 0 + 78 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +LTYPE + 5 +5 +330 +0 +100 +AcDbSymbolTable + 70 + 1 + 0 +LTYPE + 5 +14 +330 +5 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +BYBLOCK + 70 + 0 + 3 + + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +LTYPE + 5 +15 +330 +5 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +BYLAYER + 70 + 0 + 3 + + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +LTYPE + 5 +16 +330 +5 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +CONTINUOUS + 70 + 0 + 3 +Solid line + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +ENDTAB + 0 +TABLE + 2 +LAYER + 5 +2 +100 +AcDbSymbolTable + 70 +1 + 0 +LAYER + 5 +50 +100 +AcDbSymbolTableRecord +100 +AcDbLayerTableRecord + 2 +0 + 70 +0 + 6 +CONTINUOUS + 0 +ENDTAB + 0 +TABLE + 2 +STYLE + 5 +3 +330 +0 +100 +AcDbSymbolTable + 70 + 1 + 0 +STYLE + 5 +11 +330 +3 +100 +AcDbSymbolTableRecord +100 +AcDbTextStyleTableRecord + 2 +STANDARD + 70 + 0 + 40 +0.0 + 41 +1.0 + 50 +0.0 + 71 + 0 + 42 +2.5 + 3 +txt + 4 + + 0 +ENDTAB + 0 +TABLE + 2 +VIEW + 5 +6 +330 +0 +100 +AcDbSymbolTable + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +UCS + 5 +7 +330 +0 +100 +AcDbSymbolTable + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +APPID + 5 +9 +330 +0 +100 +AcDbSymbolTable + 70 + 2 + 0 +APPID + 5 +12 +330 +9 +100 +AcDbSymbolTableRecord +100 +AcDbRegAppTableRecord + 2 +ACAD + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +DIMSTYLE + 5 +A +330 +0 +100 +AcDbSymbolTable + 70 + 1 + 0 +DIMSTYLE +105 +27 +330 +A +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO-25 + 70 + 0 + 3 + + 4 + + 5 + + 6 + + 7 + + 40 +1.0 + 41 +2.5 + 42 +0.625 + 43 +3.75 + 44 +1.25 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 +140 +2.5 +141 +2.5 +142 +0.0 +143 +0.03937007874016 +144 +1.0 +145 +0.0 +146 +1.0 +147 +0.625 + 71 + 0 + 72 + 0 + 73 + 0 + 74 + 0 + 75 + 0 + 76 + 0 + 77 + 1 + 78 + 8 +170 + 0 +171 + 3 +172 + 1 +173 + 0 +174 + 0 +175 + 0 +176 + 0 +177 + 0 +178 + 0 +270 + 2 +271 + 2 +272 + 2 +273 + 2 +274 + 3 +340 +11 +275 + 0 +280 + 0 +281 + 0 +282 + 0 +283 + 0 +284 + 8 +285 + 0 +286 + 0 +287 + 3 +288 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +BLOCK_RECORD + 5 +1 +330 +0 +100 +AcDbSymbolTable + 70 + 1 + 0 +BLOCK_RECORD + 5 +1F +330 +1 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +*MODEL_SPACE + 0 +BLOCK_RECORD + 5 +1B +330 +1 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +*PAPER_SPACE + 0 +ENDTAB + 0 +ENDSEC + 0 +SECTION + 2 +BLOCKS + 0 +BLOCK + 5 +20 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbBlockBegin + 2 +*MODEL_SPACE + 70 + 0 + 10 +0.0 + 20 +0.0 + 30 +0.0 + 3 +*MODEL_SPACE + 1 + + 0 +ENDBLK + 5 +21 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbBlockEnd + 0 +BLOCK + 5 +1C +330 +1B +100 +AcDbEntity + 67 + 1 + 8 +0 +100 +AcDbBlockBegin + 2 +*PAPER_SPACE + 1 + + 0 +ENDBLK + 5 +1D +330 +1B +100 +AcDbEntity + 67 + 1 + 8 +0 +100 +AcDbBlockEnd + 0 +ENDSEC + 0 +SECTION + 2 +ENTITIES + 0 +SPLINE + 5 +100 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +62.194914 + 20 +176.050844 + 30 +0.0 + 10 +62.194914 + 20 +177.479906 + 30 +0.0 + 10 +61.432518 + 20 +178.800414 + 30 +0.0 + 10 +60.194914 + 20 +179.514945 + 30 +0.0 + 0 +SPLINE + 5 +101 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +60.194914 + 20 +179.514945 + 30 +0.0 + 10 +58.957309 + 20 +180.229476 + 30 +0.0 + 10 +57.432518 + 20 +180.229476 + 30 +0.0 + 10 +56.194914 + 20 +179.514945 + 30 +0.0 + 0 +SPLINE + 5 +102 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +56.194914 + 20 +179.514945 + 30 +0.0 + 10 +54.957309 + 20 +178.800414 + 30 +0.0 + 10 +54.194914 + 20 +177.479906 + 30 +0.0 + 10 +54.194914 + 20 +176.050844 + 30 +0.0 + 0 +SPLINE + 5 +103 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +54.194914 + 20 +176.050844 + 30 +0.0 + 10 +54.194914 + 20 +174.621781 + 30 +0.0 + 10 +54.957309 + 20 +173.301273 + 30 +0.0 + 10 +56.194914 + 20 +172.586742 + 30 +0.0 + 0 +SPLINE + 5 +104 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +56.194914 + 20 +172.586742 + 30 +0.0 + 10 +57.432518 + 20 +171.872211 + 30 +0.0 + 10 +58.957309 + 20 +171.872211 + 30 +0.0 + 10 +60.194914 + 20 +172.586742 + 30 +0.0 + 0 +SPLINE + 5 +105 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +60.194914 + 20 +172.586742 + 30 +0.0 + 10 +61.432518 + 20 +173.301273 + 30 +0.0 + 10 +62.194914 + 20 +174.621781 + 30 +0.0 + 10 +62.194914 + 20 +176.050844 + 30 +0.0 + 0 +SPLINE + 5 +106 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +152.194914 + 20 +176.050844 + 30 +0.0 + 10 +152.194914 + 20 +177.479906 + 30 +0.0 + 10 +151.432518 + 20 +178.800414 + 30 +0.0 + 10 +150.194914 + 20 +179.514945 + 30 +0.0 + 0 +SPLINE + 5 +107 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +150.194914 + 20 +179.514945 + 30 +0.0 + 10 +148.957309 + 20 +180.229476 + 30 +0.0 + 10 +147.432518 + 20 +180.229476 + 30 +0.0 + 10 +146.194914 + 20 +179.514945 + 30 +0.0 + 0 +SPLINE + 5 +108 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +146.194914 + 20 +179.514945 + 30 +0.0 + 10 +144.957309 + 20 +178.800414 + 30 +0.0 + 10 +144.194914 + 20 +177.479906 + 30 +0.0 + 10 +144.194914 + 20 +176.050844 + 30 +0.0 + 0 +SPLINE + 5 +109 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +144.194914 + 20 +176.050844 + 30 +0.0 + 10 +144.194914 + 20 +174.621781 + 30 +0.0 + 10 +144.957309 + 20 +173.301273 + 30 +0.0 + 10 +146.194914 + 20 +172.586742 + 30 +0.0 + 0 +SPLINE + 5 +10a +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +146.194914 + 20 +172.586742 + 30 +0.0 + 10 +147.432518 + 20 +171.872210 + 30 +0.0 + 10 +148.957309 + 20 +171.872210 + 30 +0.0 + 10 +150.194914 + 20 +172.586742 + 30 +0.0 + 0 +SPLINE + 5 +10b +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +150.194914 + 20 +172.586742 + 30 +0.0 + 10 +151.432518 + 20 +173.301273 + 30 +0.0 + 10 +152.194914 + 20 +174.621781 + 30 +0.0 + 10 +152.194914 + 20 +176.050844 + 30 +0.0 + 0 +LWPOLYLINE + 5 +10c +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbPolyline + 90 +1 + 70 +1 + 10 +62.194914 + 20 +176.050844 + 30 +0.0 + 0 +SPLINE + 5 +10d +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +9.519942 + 20 +191.050843 + 30 +0.0 + 10 +24.124867 + 20 +230.139866 + 30 +0.0 + 10 +61.466559 + 20 +256.050842 + 30 +0.0 + 10 +103.194913 + 20 +256.050842 + 30 +0.0 + 0 +SPLINE + 5 +10e +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +103.194913 + 20 +256.050842 + 30 +0.0 + 10 +144.923267 + 20 +256.050842 + 30 +0.0 + 10 +182.264959 + 20 +230.139866 + 30 +0.0 + 10 +196.869883 + 20 +191.050843 + 30 +0.0 + 0 +LWPOLYLINE + 5 +10f +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbPolyline + 90 +1 + 70 +1 + 10 +152.194914 + 20 +176.050844 + 30 +0.0 + 0 +SPLINE + 5 +110 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +196.869883 + 20 +121.050842 + 30 +0.0 + 10 +182.264959 + 20 +81.961820 + 30 +0.0 + 10 +144.923267 + 20 +56.050843 + 30 +0.0 + 10 +103.194913 + 20 +56.050843 + 30 +0.0 + 0 +SPLINE + 5 +111 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbSpline + 70 +8 + 71 +3 + 72 +8 + 73 +4 + 74 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +0 + 40 +1 + 40 +1 + 40 +1 + 40 +1 + 10 +103.194913 + 20 +56.050843 + 30 +0.0 + 10 +61.466559 + 20 +56.050843 + 30 +0.0 + 10 +24.124867 + 20 +81.961820 + 30 +0.0 + 10 +9.519942 + 20 +121.050842 + 30 +0.0 + 0 +LWPOLYLINE + 5 +112 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbPolyline + 90 +4 + 70 +0 + 10 +196.869883 + 20 +191.050843 + 30 +0.0 + 10 +168.194911 + 20 +191.050843 + 30 +0.0 + 10 +168.194913 + 20 +121.050842 + 30 +0.0 + 10 +196.869883 + 20 +121.050842 + 30 +0.0 + 0 +LWPOLYLINE + 5 +113 +100 +AcDbEntity + 8 +0 + 62 +7 +100 +AcDbPolyline + 90 +4 + 70 +0 + 10 +9.519942 + 20 +121.050842 + 30 +0.0 + 10 +38.194911 + 20 +121.050842 + 30 +0.0 + 10 +38.194911 + 20 +191.050843 + 30 +0.0 + 10 +9.519942 + 20 +191.050843 + 30 +0.0 + 0 +ENDSEC + 0 +SECTION + 2 +OBJECTS + 0 +DICTIONARY + 5 +C +330 +0 +100 +AcDbDictionary + 3 +ACAD_GROUP +350 +D + 3 +ACAD_MLINESTYLE +350 +17 + 0 +DICTIONARY + 5 +D +330 +C +100 +AcDbDictionary + 0 +DICTIONARY + 5 +1A +330 +C +100 +AcDbDictionary + 0 +DICTIONARY + 5 +17 +330 +C +100 +AcDbDictionary + 3 +STANDARD +350 +18 + 0 +DICTIONARY + 5 +19 +330 +C +100 +AcDbDictionary + 0 +ENDSEC + 0 +EOF diff --git "a/SonOff/Icon\r" "b/SonOff/Icon\r" new file mode 100644 index 0000000..e69de29 diff --git a/SonOff/get_ip.lua b/SonOff/get_ip.lua new file mode 100644 index 0000000..950c6ec --- /dev/null +++ b/SonOff/get_ip.lua @@ -0,0 +1,12 @@ +-- get_ip.lua +-- affiche l'adresse IP +-- zf180715.2347 + +tmr.alarm(0, 1000, tmr.ALARM_AUTO , function() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + print("Connected! IP: ",wifi.sta.getip()) + tmr.stop(0) + end +end) diff --git a/SonOff/init.lua b/SonOff/init.lua new file mode 100644 index 0000000..9d9136f --- /dev/null +++ b/SonOff/init.lua @@ -0,0 +1,94 @@ +-- init.lua +-- test si clic sur le bouton +-- clic <2s goto start.lua +-- clic >2s goto config wifi +print("\ninit.lua zf180717.1125 \n") + +zBTN = 3 -- GPIO0 button +--zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLED = 0 -- SonOff: 7 GPIO13 PWM1, NodeMCU: 0, (active low) +zFlag_LED = 0 + +function blink_LED () + if zFlag_LED==gpio.LOW then + zFlag_LED=gpio.HIGH + tmr.alarm(ztmr_LED, zTm_Off_LED, tmr.ALARM_SINGLE, blink_LED) + else + zFlag_LED=gpio.LOW + tmr.alarm(ztmr_LED, zTm_On_LED, tmr.ALARM_SINGLE, blink_LED) + end + gpio.write(zLED, zFlag_LED) +end + +gpio.mode(zLED, gpio.OUTPUT) +ztmr_LED = tmr.create() +--pwm.setup(zLED, 1, 500) +--pwm.start(zLED) +zTm_On_LED = 500 --> en ms +zTm_Off_LED = 500 --> en ms +blink_LED () + +function btn_test() + print("test") + t2=tmr.now() + t3=(t2-t1)/1000000 + print("t3: "..t3) + if gpio.read(zBTN)==1 then + tmr.stop(0) + gpio.trig(zBTN) + --pwm.stop(zLED) + tmr.stop(ztmr_LED) + gpio.write(zLED,1) + print("start.lua") + dofile("start.lua") + end + if t3>2 then + tmr.stop(0) + gpio.trig(zBTN) + --pwm.setup(zLED, 10, 500) + --pwm.start(zLED) + zTm_On_LED = 100 --> en ms + zTm_Off_LED = 100 --> en ms + blink_LED () + wifi.sta.disconnect() + wifi.sta.clearconfig() + print("\nwifi config http://192.168.4.1\n") + tmr.alarm(0, 1000, tmr.ALARM_AUTO , get_ip) + enduser_setup.start() + end +end + +function btn_clic() + print("clic") + t1=tmr.now() + --pwm.stop(zLED) + tmr.stop(ztmr_LED) + gpio.write(zLED,0) + tmr.alarm(0,100,tmr.ALARM_AUTO, btn_test) +end + +function get_ip() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + tmr.stop(0) + print("Connected! IP: ",wifi.sta.getip()) + tmr.alarm(0,3000,tmr.ALARM_SINGLE, function() node.restart() end) + end +end + +function dir() + l=file.list() + for k,v in pairs(l) do + print(k.." "..v) + end + print('\nusage: dofile("file.lua")\n') +end + + +gpio.mode(zBTN,gpio.INT) +gpio.trig(zBTN, "down", btn_clic) + +wifi.sta.connect() +dofile("telnet_srv.lua") + diff --git a/SonOff/script1 - copie.lua b/SonOff/script1 - copie.lua new file mode 100644 index 0000000..763ce02 --- /dev/null +++ b/SonOff/script1 - copie.lua @@ -0,0 +1,34 @@ +zBTN = 3 -- GPIO0 button +zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLED = 7 -- GPIO13 PWM1 GREEN LED (active low) + +--pwm.setup(zLED, 1, 500) +--pwm.start(zLED) + +gpio.mode(zBTN,gpio.INT) +pwm.stop(zLED) +gpio.write(zLED,1) + +gpio.trig(zBTN, "both",function() + if gpio.read(zBTN)==0 then + pwm.stop(zLED) + gpio.write(zLED,0) + t1=tmr.now() + else + gpio.write(zLED,1) + t2=tmr.now() + t3=(t2-t1)/1000000 + print(t3) + if t3<2 then + gpio.write(zLED,1) + print("start") + pwm.setup(zLED, 1, 500) + pwm.start(zLED) + else + print("config") + pwm.setup(zLED, 10, 500) + pwm.start(zLED) + end + + end +end) diff --git a/SonOff/start.lua b/SonOff/start.lua new file mode 100644 index 0000000..d965baa --- /dev/null +++ b/SonOff/start.lua @@ -0,0 +1,11 @@ +-- start.lua +-- programme de start +-- zf180715.2359 + +zBTN = 3 -- GPIO0 button +zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLED = 7 -- GPIO13 PWM1 GREEN LED (active low) + +gpio.mode(zLED,gpio.OUTPUT) +pwm.setup(zLED, 2, 900) +pwm.start(zLED) diff --git a/SonOff/stop.lua b/SonOff/stop.lua new file mode 100644 index 0000000..887848b --- /dev/null +++ b/SonOff/stop.lua @@ -0,0 +1,13 @@ +-- stop.lua +-- programme de stop +-- zf180716.0010 + +zBTN = 3 -- GPIO0 button +zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLED = 7 -- GPIO13 PWM1 GREEN LED (active low) + +gpio.mode(zLED,gpio.OUTPUT) +pwm.stop(zLED) +gpio.write(zLED,1) + + diff --git a/SonOff/telnet_srv.lua b/SonOff/telnet_srv.lua new file mode 100644 index 0000000..32e2cf0 --- /dev/null +++ b/SonOff/telnet_srv.lua @@ -0,0 +1,42 @@ +-- a simple telnet server + +-- restart server if needed +if telnet_srv ~= nil then + telnet_srv:close() +end +telnet_srv = net.createServer(net.TCP, 180) + +telnet_srv:listen(23, function(socket) + local fifo = {} + local fifo_drained = true + + local function sender(c) + if #fifo > 0 then + c:send(table.remove(fifo, 1)) + else + fifo_drained = true + end + end + + local function s_output(str) + table.insert(fifo, str) + if socket ~= nil and fifo_drained then + fifo_drained = false + sender(socket) + end + end + + node.output(s_output, 0) -- re-direct output to function s_ouput. + + socket:on("receive", function(c, l) + node.input(l) -- works like pcall(loadstring(l)) but support multiple separate line + end) + socket:on("disconnection", function(c) + node.output(nil) -- un-regist the redirect output function, output goes to serial + end) + socket:on("sent", sender) + + print("Welcome to NodeMCU world.") +end) + +print("Telnet server running...") diff --git a/Wifi_led_onoff.lua b/Wifi_led_onoff.lua new file mode 100644 index 0000000..7ff2709 --- /dev/null +++ b/Wifi_led_onoff.lua @@ -0,0 +1,51 @@ +--Petit serveur WEB pour allumer/éteindre une LED en mode client WIFI +--hv20180711.1606 + +print("Démarrage") +--wifi.sta.disconnect() +--wifi.setmode(wifi.STATION) +--print("set mode=STATION (mode="..wifi.getmode()..")") +--wifi.sta.config{ssid="Hugo", pwd="tototutu"} + +wifi.sta.connect() + +tmr.alarm(0, 1000, tmr.ALARM_AUTO , function() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + print("Connected! IP: ",wifi.sta.getip()) + tmr.stop(0) + end +end) + +zLED=0 +gpio.mode(zLED, gpio.OUTPUT) +gpio.write(zLED, gpio.HIGH) +srv = net.createServer(net.TCP) +srv:listen(80, function(conn) + conn:on("receive", function(client, request) + local buf = "" + local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") + if (method == nil) then + _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP") + end + local _GET = {} + if (vars ~= nil) then + for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do + _GET[k] = v + end + end + buf = buf .. "

Hello, this is NodeMCU.

Turn PIN
" + client:send(buf) + end) + conn:on("sent", function(c) c:close() end) +end) diff --git a/blink_led1 - copie.lua b/blink_led1 - copie.lua new file mode 100644 index 0000000..a47a966 --- /dev/null +++ b/blink_led1 - copie.lua @@ -0,0 +1,22 @@ +-- programme pour faire clignoter un LED +--hv20180711.1007 + +zpin=1 +valeur=gpio.HIGH +duration = 300 --> en ms + + +function clignoter () + if valeur==gpio.LOW then + valeur=gpio.HIGH + else + valeur=gpio.LOW + end + gpio.write(zpin, valeur) +end + + +gpio.mode(zpin, gpio.OUTPUT) +gpio.write(zpin, valeur) + +tmr.alarm(0,duration, tmr.ALARM_AUTO, clignoter) diff --git a/blink_led1.lua b/blink_led1.lua new file mode 100644 index 0000000..902bbdc --- /dev/null +++ b/blink_led1.lua @@ -0,0 +1,22 @@ +-- programme pour faire clignoter une LED avec un rapport on/off +--zf20180717.1118 + +zLED=0 +zTm_On_LED = 900 --> en ms +zTm_Off_LED = 900 --> en ms +zFlag_LED = 0 + +function blink_LED () + if zFlag_LED==gpio.LOW then + zFlag_LED=gpio.HIGH + tmr.alarm(ztmr_LED, zTm_Off_LED, tmr.ALARM_SINGLE, blink_LED) + else + zFlag_LED=gpio.LOW + tmr.alarm(ztmr_LED, zTm_On_LED, tmr.ALARM_SINGLE, blink_LED) + end + gpio.write(zLED, zFlag_LED) +end + +gpio.mode(zLED, gpio.OUTPUT) +ztmr_LED = tmr.create() +blink_LED () diff --git a/btn_led.lua b/btn_led.lua new file mode 100644 index 0000000..d61af6b --- /dev/null +++ b/btn_led.lua @@ -0,0 +1,17 @@ +-- Programme qui allume la led bleue quand on appuie le bouton flash +-- hv180711.1125 + +zledbleue=0 --led bleue +zswitch=3--switch flash + +gpio.mode(zswitch, gpio.INT, gpio.PULLUP) + +function bouton() + if gpio.read(zswitch)==0 then + gpio.write(zledbleue, gpio.LOW) + else + gpio.write(zledbleue, gpio.HIGH) + end +end + +gpio.trig(zswitch, "both", bouton) diff --git a/clear_bootstrap.lua b/clear_bootstrap.lua new file mode 100644 index 0000000..610752c --- /dev/null +++ b/clear_bootstrap.lua @@ -0,0 +1,38 @@ +-- test de clearing de functions +print("\n clear_bootstrap.lua zf180720.1510 \n") + +zRelay=nil + +-- blink LED +if ztmr_LEDz then + tmr.stop(ztmr_LEDz) + tmr.unregister(ztmr_LEDz) + ztmr_LEDz=nil +end +if zLEDz then + gpio.mode(zLEDz, gpio.INPUT) +end +blink_LEDz=nil zLEDz=nil zFlag_LEDz=nil zTm_On_LEDz=nil zTm_Off_LEDz=nil + +-- btn read +if ztmr_btnz then + tmr.stop(ztmr_btnz) + tmr.unregister(ztmr_btnz) + ztmr_btnz=nil +end +if zBTNz then +gpio.trig(zBTNz, "none") +gpio.mode(zBTNz, gpio.INPUT) +zBTNz=nil +end +btn_clicz=nil btn_testz=nil t1z=nil t2z=nil t3z=nil + +-- get ip +if ztmr_get_ipz then + tmr.stop(ztmr_get_ipz) + get_ipz=nil +end + +-- dir files +dir=nil l=nil k=nil v=nil i=nil + diff --git a/code2file.lua b/code2file.lua new file mode 100644 index 0000000..952d006 --- /dev/null +++ b/code2file.lua @@ -0,0 +1,11 @@ +-- écriture d'un script dans un fichier et l'exécute +-- zf180717.1517 +jj = [[ + print("toto") + print("tutu") +]] + +file.open("toto1518.lua","w") +file.write(jj) +file.close() +dofile("toto1518.lua") diff --git a/dir.lua b/dir.lua new file mode 100644 index 0000000..9c1494e --- /dev/null +++ b/dir.lua @@ -0,0 +1,15 @@ +-- fonction dir() pour afficher les fichiers dans la flash +-- zf180717.1542 + +function dir() + print("\n-------------------------------") + l=file.list() i=0 + for k,v in pairs(l) do + i=i+v + print(k..string.rep(" ",19-string.len(k)).." : "..v.." bytes") + end + print("-------------------------------") + print('\nUsed: '..i..' bytes\nusage: dofile("file.lua")\n') +end + +dir() diff --git a/fleche.lua b/fleche.lua new file mode 100644 index 0000000..1f24578 --- /dev/null +++ b/fleche.lua @@ -0,0 +1,22 @@ +print("Hello zuzu\nVersion 0.1.1") + +-- Dessine une flèche sur la console +-- hv 180706.1059 +-- source: + +taille_fleche= 6 + +for i=1, 2*taille_fleche do +-- pointe de la fleche + if i==1 then print(string.rep(" ",taille_fleche).."*") + +-- tete de la fleche + elseif i==2 or itaille_fleche then print(string.rep(" ",taille_fleche).."*") + end +end diff --git a/get_ip.lua b/get_ip.lua new file mode 100644 index 0000000..018b75c --- /dev/null +++ b/get_ip.lua @@ -0,0 +1,14 @@ +-- get_ip.lua +-- branche le wifi et affiche l'adresse IP +-- zf180719.1039 + +wifi.sta.connect() + +tmr.alarm(0, 1000, tmr.ALARM_AUTO , function() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + print("Connected! IP: ",wifi.sta.getip()) + tmr.stop(0) + end +end) diff --git a/helloworld.lua b/helloworld.lua new file mode 100644 index 0000000..c40c4bc --- /dev/null +++ b/helloworld.lua @@ -0,0 +1,13 @@ +-- blink the blue led builting +-- zf180709.2200 + +zpin=0 --led blue builting +gpio.mode(zpin, gpio.OUTPUT) + +for i=1,20 do + print("Hello World "..i) + gpio.write(zpin, gpio.LOW) + tmr.delay(100000) + gpio.write(zpin, gpio.HIGH) + tmr.delay(100000) +end diff --git a/init_minizf.lua b/init_minizf.lua new file mode 100644 index 0000000..407a43d --- /dev/null +++ b/init_minizf.lua @@ -0,0 +1,2 @@ +print("\nzinit zf180713.1449\n") + diff --git a/initz - copie 2.lua b/initz - copie 2.lua new file mode 100644 index 0000000..afcd9fc --- /dev/null +++ b/initz - copie 2.lua @@ -0,0 +1,90 @@ +-- initz.lua +-- test si clic sur le bouton +-- clic <2s goto start.lua +-- clic >2s goto config wifi +print("\ninit.lua zf180719.1100 \n") + +zBTNz = 3 -- GPIO0 button +--zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLEDz = 0 -- SonOff: 7 GPIO13 PWM1, NodeMCU: 0, (active low) +zFlag_LEDz = 0 + +function blink_LEDz () + if zFlag_LEDz==gpio.LOW then + zFlag_LEDz=gpio.HIGH + tmr.alarm(ztmr_LEDz, zTm_Off_LEDz, tmr.ALARM_SINGLE, blink_LEDz) + else + zFlag_LEDz=gpio.LOW + tmr.alarm(ztmr_LEDz, zTm_On_LEDz, tmr.ALARM_SINGLE, blink_LEDz) + end + gpio.write(zLEDz, zFlag_LEDz) +end + +gpio.mode(zLEDz, gpio.OUTPUT) +ztmr_LEDz = tmr.create() +zTm_On_LEDz = 500 +zTm_Off_LEDz = 500 +blink_LEDz () + +function btn_testz() + t2z=tmr.now() + t3z=(t2z-t1z)/1000000 + if gpio.read(zBTNz)==1 then + tmr.stop(0) + gpio.trig(zBTNz) + tmr.stop(ztmr_LEDz) + gpio.write(zLEDz,1) + print("start.lua") + + ztmr_clear_bootstrapz = tmr.create() +-- tmr.alarm(ztmr_clear_bootstrapz,1000,tmr.ALARM_SINGLE, function() dofile("clear_bootstrap.lua") end) + + + + dofile("start.lua") + end + if t3z>2 then + tmr.stop(0) + gpio.trig(zBTNz) + zTm_On_LEDz = 100 + zTm_Off_LEDz = 100 + blink_LEDz () + wifi.sta.disconnect() + wifi.sta.clearconfig() + print("\nwifi config http://192.168.4.1\n") + tmr.alarm(0, 1000, tmr.ALARM_AUTO , get_ipz) + enduser_setup.start() + end +end + +function btn_clicz() + t1z=tmr.now() + tmr.stop(ztmr_LEDz) + gpio.write(zLEDz,0) + tmr.alarm(0,100,tmr.ALARM_AUTO, btn_testz) +end + +function get_ipz() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + tmr.stop(0) + print("Connected! IP: ",wifi.sta.getip()) + tmr.alarm(0,4000,tmr.ALARM_SINGLE, function() node.restart() end) + end +end + +function dir() + l=file.list() i=0 + for k,v in pairs(l) do + i=i+v print(k..string.rep(" ",19-string.len(k)).." : "..v.." bytes") + end + print('\nUsed: '..i..' bytes\nusage: dofile("file.lua")\n') +end + +gpio.mode(zBTNz,gpio.INT) +gpio.trig(zBTNz, "down", btn_clicz) + +wifi.sta.connect() +dofile("telnet_srv.lua") + diff --git a/initz - copie.lua b/initz - copie.lua new file mode 100644 index 0000000..240ab42 --- /dev/null +++ b/initz - copie.lua @@ -0,0 +1,90 @@ +-- initz.lua +-- test si clic sur le bouton +-- clic <2s goto start.lua +-- clic >2s goto config wifi +print("\ninit.lua zf180719.1045 \n") + +zBTN = 3 -- GPIO0 button +--zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLED = 0 -- SonOff: 7 GPIO13 PWM1, NodeMCU: 0, (active low) +zFlag_LED = 0 + +function blink_LED () + if zFlag_LED==gpio.LOW then + zFlag_LED=gpio.HIGH + tmr.alarm(ztmr_LED, zTm_Off_LED, tmr.ALARM_SINGLE, blink_LED) + else + zFlag_LED=gpio.LOW + tmr.alarm(ztmr_LED, zTm_On_LED, tmr.ALARM_SINGLE, blink_LED) + end + gpio.write(zLED, zFlag_LED) +end + +gpio.mode(zLED, gpio.OUTPUT) +ztmr_LED = tmr.create() +zTm_On_LED = 500 +zTm_Off_LED = 500 +blink_LED () + +function btn_test() + t2=tmr.now() + t3=(t2-t1)/1000000 + if gpio.read(zBTN)==1 then + tmr.stop(0) + gpio.trig(zBTN) + tmr.stop(ztmr_LED) + gpio.write(zLED,1) + print("start.lua") + + ztmr_clear_bootstrap = tmr.create() + tmr.alarm(ztmr_clear_bootstrap,1000,tmr.ALARM_SINGLE, function() dofile("clear_bootstrap.lua") end) + + + + dofile("start.lua") + end + if t3>2 then + tmr.stop(0) + gpio.trig(zBTN) + zTm_On_LED = 100 + zTm_Off_LED = 100 + blink_LED () + wifi.sta.disconnect() + wifi.sta.clearconfig() + print("\nwifi config http://192.168.4.1\n") + tmr.alarm(0, 1000, tmr.ALARM_AUTO , get_ip) + enduser_setup.start() + end +end + +function btn_clic() + t1=tmr.now() + tmr.stop(ztmr_LED) + gpio.write(zLED,0) + tmr.alarm(0,100,tmr.ALARM_AUTO, btn_test) +end + +function get_ip() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + tmr.stop(0) + print("Connected! IP: ",wifi.sta.getip()) + tmr.alarm(0,4000,tmr.ALARM_SINGLE, function() node.restart() end) + end +end + +function dir() + l=file.list() i=0 + for k,v in pairs(l) do + i=i+v print(k..string.rep(" ",19-string.len(k)).." : "..v.." bytes") + end + print('\nUsed: '..i..' bytes\nusage: dofile("file.lua")\n') +end + +gpio.mode(zBTN,gpio.INT) +gpio.trig(zBTN, "down", btn_clic) + +wifi.sta.connect() +dofile("telnet_srv.lua") + diff --git a/initz.lua b/initz.lua new file mode 100644 index 0000000..ab93bf3 --- /dev/null +++ b/initz.lua @@ -0,0 +1,75 @@ +-- initz.lua +-- test si clic sur le bouton +-- clic <2s goto start.lua +-- clic >2s goto config wifi +print("\ninit.lua zf180720.1550 \n") + +zBTNz = 3 -- GPIO0 button +--zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLEDz = 0 -- SonOff: 7 GPIO13 PWM1, NodeMCU: 0, (active low) +zFlag_LEDz = 0 + +function blink_LEDz () + if zFlag_LEDz==gpio.LOW then + zFlag_LEDz=gpio.HIGH tmr.alarm(ztmr_LEDz, zTm_Off_LEDz, tmr.ALARM_SINGLE, blink_LEDz) + else + zFlag_LEDz=gpio.LOW tmr.alarm(ztmr_LEDz, zTm_On_LEDz, tmr.ALARM_SINGLE, blink_LEDz) + end + gpio.write(zLEDz, zFlag_LEDz) +end + +gpio.mode(zLEDz, gpio.OUTPUT) +ztmr_LEDz = tmr.create() zTm_On_LEDz = 500 zTm_Off_LEDz = 500 blink_LEDz () + +function btn_testz() + t2z=tmr.now() + t3z=(t2z-t1z)/1000000 + if gpio.read(zBTNz)==1 then + tmr.stop(ztmr_btnz) + tmr.stop(ztmr_LEDz) gpio.write(zLEDz,1) + print("start.lua") + ztmr_clear_bootstrapz = tmr.create() + tmr.alarm(ztmr_clear_bootstrapz, 1000, tmr.ALARM_SINGLE, function() dofile("clear_bootstrap.lua") end) + dofile("start.lua") + else + if t3z>3 then + tmr.stop(ztmr_btnz) + zTm_On_LEDz = 100 zTm_Off_LEDz = 100 blink_LEDz () + wifi.sta.disconnect() wifi.sta.clearconfig() + print("\nwifi config http://192.168.4.1\n") + ztmr_get_ipz = tmr.create() tmr.alarm(ztmr_get_ipz, 4000, tmr.ALARM_AUTO , get_ipz) + enduser_setup.start() + end + end +end + +function btn_clicz() + gpio.trig(zBTNz, "none") gpio.mode(zBTNz,gpio.INPUT) + t1z=tmr.now() + tmr.stop(ztmr_LEDz) gpio.write(zLEDz,0) + ztmr_btnz = tmr.create() tmr.alarm(ztmr_btnz, 500,tmr.ALARM_AUTO, btn_testz) +end + +function get_ipz() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + tmr.stop(ztmr_get_ipz) + print("Connected! IP: ",wifi.sta.getip()) + tmr.alarm(ztmr_get_ipz,1000,tmr.ALARM_SINGLE, function() node.restart() end) + end +end + +function dir() + l=file.list() i=0 + for k,v in pairs(l) do + i=i+v print(k..string.rep(" ",19-string.len(k)).." : "..v.." bytes") + end + print('\nUsed: '..i..' bytes\nusage: dofile("file.lua")\n') +end + +gpio.mode(zBTNz,gpio.INT) gpio.trig(zBTNz, "down", btn_clicz) + +wifi.sta.connect() +dofile("telnet_srv.lua") + diff --git a/show_ip.lua b/show_ip.lua new file mode 100644 index 0000000..fad7ab7 --- /dev/null +++ b/show_ip.lua @@ -0,0 +1,11 @@ +--Affiche l'adresse IP +--zf20180712.1110 + +tmr.alarm(0, 1000, tmr.ALARM_AUTO , function() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + print("Connected! IP: ",wifi.sta.getip()) + tmr.stop(0) + end +end) diff --git a/start - copie.lua b/start - copie.lua new file mode 100644 index 0000000..f4a1cda --- /dev/null +++ b/start - copie.lua @@ -0,0 +1,27 @@ +-- start.lua +-- programme de start +-- zf180719.1057 + +do + +local zLED=0 +local zTm_On_LED = 100 --> en ms +local zTm_Off_LED = 900 --> en ms +local zFlag_LED = 0 + +local function blink_LED () + local ztmr_LED = tmr.create() + if zFlag_LED==gpio.LOW then + zFlag_LED=gpio.HIGH + tmr.alarm(ztmr_LED, zTm_Off_LED, tmr.ALARM_SINGLE, blink_LED) + else + zFlag_LED=gpio.LOW + tmr.alarm(ztmr_LED, zTm_On_LED, tmr.ALARM_SINGLE, blink_LED) + end + gpio.write(zLED, zFlag_LED) +end + +gpio.mode(zLED, gpio.OUTPUT) +blink_LED () + +end diff --git a/start.lua b/start.lua new file mode 100644 index 0000000..15b2568 --- /dev/null +++ b/start.lua @@ -0,0 +1,23 @@ +-- start.lua +-- programme de start +-- zf180717.1141 + +zLED=0 +zTm_On_LED = 100 --> en ms +zTm_Off_LED = 900 --> en ms +zFlag_LED = 0 + +function blink_LED () + if zFlag_LED==gpio.LOW then + zFlag_LED=gpio.HIGH + tmr.alarm(ztmr_LED, zTm_Off_LED, tmr.ALARM_SINGLE, blink_LED) + else + zFlag_LED=gpio.LOW + tmr.alarm(ztmr_LED, zTm_On_LED, tmr.ALARM_SINGLE, blink_LED) + end + gpio.write(zLED, zFlag_LED) +end + +gpio.mode(zLED, gpio.OUTPUT) +ztmr_LED = tmr.create() +blink_LED() diff --git a/stop.lua b/stop.lua new file mode 100644 index 0000000..887848b --- /dev/null +++ b/stop.lua @@ -0,0 +1,13 @@ +-- stop.lua +-- programme de stop +-- zf180716.0010 + +zBTN = 3 -- GPIO0 button +zRelay = 6 -- GPIO12 PWM0 relay (active high) +zLED = 7 -- GPIO13 PWM1 GREEN LED (active low) + +gpio.mode(zLED,gpio.OUTPUT) +pwm.stop(zLED) +gpio.write(zLED,1) + + diff --git a/telnet_srv.lua b/telnet_srv.lua new file mode 100644 index 0000000..28beaa5 --- /dev/null +++ b/telnet_srv.lua @@ -0,0 +1,45 @@ +-- a simple telnet server +print("\nzf180719.1043 \n") + +-- restart server if needed +if telnet_srv ~= nil then + telnet_srv:close() +end +telnet_srv = net.createServer(net.TCP, 180) + +telnet_srv:listen(23, function(socket) + local fifo = {} + local fifo_drained = true + + local function sender(c) + if #fifo > 0 then + c:send(table.remove(fifo, 1)) + else + fifo_drained = true + end + end + + local function s_output(str) + table.insert(fifo, str) + if socket ~= nil and fifo_drained then + fifo_drained = false + sender(socket) + end + end + + node.output(s_output, 0) -- re-direct output to function s_ouput. + + socket:on("receive", function(c, l) + node.input(l) -- works like pcall(loadstring(l)) but support multiple separate line + end) + socket:on("disconnection", function(c) + node.output(nil) -- un-regist the redirect output function, output goes to serial + end) + socket:on("sent", sender) + + print("Welcome to NodeMCU world.") +end) + +print("Telnet server running...\nUsage: telnet -r ip\n") +dofile("get_ip.lua") + diff --git a/toto1.lua b/toto1.lua new file mode 100644 index 0000000..56c194d --- /dev/null +++ b/toto1.lua @@ -0,0 +1,3 @@ +print("hello world") + + diff --git a/web_on_off1.lua b/web_on_off1.lua new file mode 100644 index 0000000..670319d --- /dev/null +++ b/web_on_off1.lua @@ -0,0 +1,51 @@ +--Petit serveur WEB pour allumer/éteindre une LED en mode client WIFI +print("\nDémarrage hv&zf20180718.1041\n") + +--wifi.sta.disconnect() +--wifi.setmode(wifi.STATION) +--print("set mode=STATION (mode="..wifi.getmode()..")") +--wifi.sta.config{ssid="Hugo", pwd="tototutu"} + +wifi.sta.connect() +tmr.alarm(0, 1000, tmr.ALARM_AUTO , function() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + print("Connected! IP: ",wifi.sta.getip()) + tmr.stop(0) + end +end) + +zLED=0 + +gpio.mode(zLED, gpio.OUTPUT) +gpio.write(zLED, gpio.HIGH) +srv = net.createServer(net.TCP) +srv:listen(80, function(conn) + conn:on("receive", function(client, request) + local buf = "" + local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") + if (method == nil) then + _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP") + end + local _GET = {} + if (vars ~= nil) then + for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do + _GET[k] = v + end + end + buf = buf .. "

Hello, this is NodeMCU.

Turn PIN :

" + local _on, _off = "", "" + if (_GET.pin == "ON") then + _on = " selected=true" + gpio.write(zLED, gpio.LOW) + elseif (_GET.pin == "OFF") then + _off = " selected=\"true\"" + gpio.write(zLED, gpio.HIGH) + end + buf = buf .. " " + client:send(buf) + end) + conn:on("sent", function(c) c:close() end) +end) + diff --git a/web_stop.lua b/web_stop.lua new file mode 100644 index 0000000..c4f2366 --- /dev/null +++ b/web_stop.lua @@ -0,0 +1,8 @@ +--Pour arrêter le petit serveur WEB +print("\nzf20180718.1049") + +srv:close() +srv:listen(80, function(conn) +end) + +print("\nWEB stopped\n") diff --git a/wifi_off.lua b/wifi_off.lua new file mode 100644 index 0000000..54fcc3d --- /dev/null +++ b/wifi_off.lua @@ -0,0 +1,4 @@ +-- Déconnecte le WIFI +-- zf180713.1453 + +wifi.sta.disconnect() diff --git a/wificnf_start.lua b/wificnf_start.lua new file mode 100644 index 0000000..33321bc --- /dev/null +++ b/wificnf_start.lua @@ -0,0 +1,19 @@ +-- Enclenche le mode configuration WIFI +print("\nzf180718.1107\n") + +function get_ip() + if wifi.sta.getip() == nil then + print("Connecting to AP...") + else + tmr.stop(0) + print("Connected! IP: ",wifi.sta.getip()) + tmr.alarm(0,3000,tmr.ALARM_SINGLE, function() node.restart() end) + end +end + +wifi.sta.disconnect() +wifi.sta.clearconfig() +print("\nwifi config http://192.168.4.1\n") +tmr.alarm(0, 1000, tmr.ALARM_AUTO , get_ip) +enduser_setup.start() + diff --git a/wificnf_stop.lua b/wificnf_stop.lua new file mode 100644 index 0000000..cf2f3ba --- /dev/null +++ b/wificnf_stop.lua @@ -0,0 +1,4 @@ +-- Déclenche le mode configuration WIFI +-- zf180713.1453 + +enduser_setup.stop()