Avancé sur le projet Timetable d'Alexandre. Cela ne fonctionne pas encore ;-(

This commit is contained in:
Christian Zufferey
2019-04-09 14:01:54 +02:00
parent 8c70035de0
commit e52c4cedf0
11 changed files with 274 additions and 9 deletions

Binary file not shown.

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<module fritzingVersion="0.9.3b" moduleId="VerticalResistorModuleID">
<version>4</version>
<title>Vertical Resistor</title>
<label>R</label>
<date>2009-09-08</date>
<author>Stephen Lilley</author>
<tags>
<tag>Resistor</tag>
<tag>basic resistor</tag>
<tag>fritzing core</tag>
</tags>
<properties>
<property name="family">Resistor</property>
<property name="Pin Spacing">100 mil (stand-up right)</property>
<property name="package">THT</property>
<property name="bands">Vertical</property>
<property name="power" showInLabel="yes"></property>
<property name="Resistance" showInLabel="yes">220</property>
<property name="tolerance" showInLabel="yes">&#177;5%</property>
<property name="variant">vertical</property>
</properties>
<taxonomy>discreteParts.resistor.220</taxonomy>
<description>A generic resistor (0.25W)</description>
<spice><line>R{instanceTitle} {net connector0} {net connector1} {resistance}</line></spice>
<views>
<iconView>
<layers image="icon/resistor-vertical_icon.svg" >
<layer layerId="icon" />
</layers>
</iconView>
<breadboardView>
<layers image="breadboard/resistor-vertical_breadboard.svg">
<layer layerId="breadboard" />
</layers>
</breadboardView>
<schematicView>
<layers image="schematic/resistor-vertical_schematic.svg">
<layer layerId="schematic" />
</layers>
</schematicView>
<pcbView>
<layers image="pcb/axial_stand0_2_100mil_pcb.svg">
<layer layerId="copper0" />
<layer layerId="copper1" />
<layer layerId="keepout" />
<layer layerId="soldermask" />
<layer layerId="silkscreen" />
<layer layerId="outline" />
</layers>
</pcbView>
</views>
<connectors>
<connector type="male" id="connector0" name="Pin 0">
<description>Pin0</description>
<views>
<breadboardView>
<p svgId="connector0pin" layer="breadboard"/>
</breadboardView>
<schematicView>
<p svgId="connector0pin" layer="schematic" terminalId="connector0terminal" />
</schematicView>
<pcbView>
<p svgId="connector0pin" layer="copper0" />
<p svgId="connector0pin" layer="copper1" />
</pcbView>
</views>
</connector>
<connector type="male" id="connector1" name="Pin 1">
<description>Pin 1</description>
<views>
<breadboardView>
<p svgId="connector1pin" layer="breadboard"/>
</breadboardView>
<schematicView>
<p svgId="connector1pin" layer="schematic" terminalId="connector1terminal" />
</schematicView>
<pcbView>
<p svgId="connector1pin" layer="copper0" />
<p svgId="connector1pin" layer="copper1" />
</pcbView>
</views>
</connector>
</connectors>
</module>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X6 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="0.161874in" height="0.093748in" version="1.1" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd"
viewBox="0 0 22540 13054"
xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="breadboard">
<metadata id="CorelCorpID_0Corel-Layer"/>
<rect id="connector1pin" fill="none" x="19059" y="5135" width="2785" height="2785"/>
<rect id="connector0pin" fill="none" x="5069" y="5161" width="2785" height="2785"/>
<circle fill="#D9B477" cx="6527" cy="6527" r="6527"/>
<path fill="#C79D5A" d="M2458 11567c1117,895 2537,1434 4081,1434 3605,0 6527,-2922 6527,-6527 0,-1528 -514,-2932 -1442,-4000 -143,-164 -310,-256 -217,-33 646,1532 807,2582 541,4093 -517,2933 -2386,4958 -5409,5257 -1682,167 -1982,-62 -2870,-299 -929,-247 -2918,-1296 -1211,74z"/>
<circle fill="#DEBD88" cx="6527" cy="6527" r="5318"/>
<path fill="black" fill-opacity="0.301961" d="M12548 9124c-1856,-871 -3155,-2300 -4284,-3898 -1089,928 -2178,1855 -3267,2782 1523,1861 3040,3786 4727,4171 1261,-664 2220,-1758 2824,-3055z"/>
<circle fill="#8C8C8C" cx="6527" cy="6527" r="2089"/>
<line fill="none" stroke="#8C8C8C" stroke-width="4177.32" stroke-linecap="round" x1="20451" y1="6527" x2="6527" y2= "6527" />
<path id="ReflexLeft" fill="white" fill-opacity="0.560784" d="M1471 4438c-765,1757 -888,64 -408,-916 407,-833 764,-1340 1590,-1912 883,-612 2851,-822 1005,291 -1015,611 -1738,1506 -2187,2537z"/>
<path id="ReflexLeft_0" fill="white" fill-opacity="0.349020" d="M9242 5893c-935,0 -1692,-217 -1692,-484 0,-267 757,-484 1692,-484 935,0 1692,217 1692,484 0,267 -757,484 -1692,484z"/>
<path fill="#CCCCCC" fill-opacity="0.301961" d="M17177 6119c-1236,-70 -2441,-107 -3693,-95 -1298,13 -2543,58 -3905,166 -297,24 -3119,64 -3119,363 0,300 2789,437 3081,452 1318,69 2401,68 3943,48 1214,-15 2428,-39 3642,-58 291,-4 3583,-143 3583,-442 0,-299 -3191,-416 -3533,-435z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X6 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="0.161874in" height="0.093748in" version="1.1" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd"
viewBox="0 0 22540 13054"
xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="breadboard">
<metadata id="CorelCorpID_0Corel-Layer"/>
<rect id="connector1pin" fill="none" stroke="#373435" stroke-width="417.732" x="19755" y="5831" width="1392" height="1392"/>
<rect id="connector0pin" fill="none" stroke="#373435" stroke-width="417.732" x="5765" y="5858" width="1392" height="1392"/>
<circle fill="#D9B477" cx="6527" cy="6527" r="6527"/>
<path fill="#C79D5A" d="M2458 11567c1117,895 2537,1434 4081,1434 3605,0 6527,-2922 6527,-6527 0,-1528 -514,-2932 -1442,-4000 -143,-164 -310,-256 -217,-33 646,1532 807,2582 541,4093 -517,2933 -2386,4958 -5409,5257 -1682,167 -1982,-62 -2870,-299 -929,-247 -2918,-1296 -1211,74z"/>
<circle fill="#DEBD88" cx="6527" cy="6527" r="5318"/>
<circle fill="#E3C799" cx="6527" cy="6527" r="3760"/>
<path fill="black" fill-opacity="0.301961" d="M12548 9124c-1856,-871 -3155,-2300 -4284,-3898 -1089,928 -2178,1855 -3267,2782 1523,1861 3040,3786 4727,4171 1261,-664 2220,-1758 2824,-3055z"/>
<circle fill="#8C8C8C" cx="6527" cy="6527" r="2089"/>
<line fill="none" stroke="#8C8C8C" stroke-width="4177.32" stroke-linecap="round" x1="20451" y1="6527" x2="6527" y2= "6527" />
<path id="ReflexLeft" fill="white" fill-opacity="0.560784" d="M1471 4438c-765,1757 -888,64 -408,-916 407,-833 764,-1340 1590,-1912 883,-612 2851,-822 1005,291 -1015,611 -1738,1506 -2187,2537z"/>
<path id="ReflexLeft_0" fill="white" fill-opacity="0.349020" d="M9242 5893c-935,0 -1692,-217 -1692,-484 0,-267 757,-484 1692,-484 935,0 1692,217 1692,484 0,267 -757,484 -1692,484z"/>
<path fill="#CCCCCC" fill-opacity="0.301961" d="M17177 6119c-1236,-70 -2441,-107 -3693,-95 -1298,13 -2543,58 -3905,166 -297,24 -3119,64 -3119,363 0,300 2789,437 3081,452 1318,69 2401,68 3943,48 1214,-15 2428,-39 3642,-58 291,-4 3583,-143 3583,-442 0,-299 -3191,-416 -3533,-435z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='UTF-8'?>
<svg width="0.2in" version="1.2" xmlns="http://www.w3.org/2000/svg" height="0.125in" viewBox="0 0 200 125" baseProfile="tiny" >
<desc>Fritzing footprint SVG</desc>
<g id="silkscreen" >
<circle fill="none" cx="62.5" cy="62.5" stroke="white" r="57" stroke-width="10" />
<rect stroke="white" fill="white" width="20" height="20" x="102.5" y="52.5" stroke-width="10" />
</g>
<g id="copper0" >
<g id="copper1" >
<!-- <rect width="55" x="35" y="35" fill="none" height="55" stroke="rgb(255, 191, 0)" stroke-width="20" /> -->
<circle fill="none" cx="62.5" cy="62.5" stroke="rgb(255, 191, 0)" r="27.5" id="connector0pin" stroke-width="20" />
<circle fill="none" cx="162.5" cy="62.5" stroke="rgb(255, 191, 0)" r="27.5" id="connector1pin" stroke-width="20" />
</g>
</g>
<g id="keepout" />
<g id="soldermask" />
<g id="outline" />
</svg>

After

Width:  |  Height:  |  Size: 902 B

View File

@@ -0,0 +1,21 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created with Fritzing (http://www.fritzing.org/) -->
<svg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.2' baseProfile='tiny' x='0in' y='0in' width='0.409722in' height='0.086in' viewBox='0 0 10.4069 2.1844' >
<g id='schematic'>
<line class='other' x1='2.66347' y1='1.0922' x2='3.04447' y2='0.0762' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='3.04447' y1='0.0762' x2='3.67947' y2='2.1082' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='3.67947' y1='2.1082' x2='4.31447' y2='0.0762' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='4.31447' y1='0.0762' x2='4.94947' y2='2.1082' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='4.94947' y1='2.1082' x2='5.58447' y2='0.0762' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='5.58447' y1='0.0762' x2='6.21947' y2='2.1082' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='6.21947' y1='2.1082' x2='6.85447' y2='0.0762' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='6.85447' y1='0.0762' x2='7.48947' y2='2.1082' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='other' x1='7.48947' y1='2.1082' x2='7.74347' y2='1.0922' stroke='#000000' stroke-width='0.1524' stroke-linecap='round'/>
<line class='pin' id='connector1pin' connectorname='2' x1='10.2835' y1='1.0922' x2='7.74347' y2='1.0922' stroke='#787878' stroke-width='0.246944' stroke-linecap='round'/>
<rect class='terminal' id='connector1terminal' x='10.2835' y='1.0922' width='0.0001' height='0.0001' stroke='none' stroke-width='0' fill='none'/>
<text class='text' font-family="'Droid Sans'" stroke='none' stroke-width='0' fill='#8c8c8c' font-size='0.881944' x='9.01347' y='0.721784' text-anchor='middle'>2</text>
<line class='pin' id='connector0pin' connectorname='1' x1='0.123472' y1='1.0922' x2='2.66347' y2='1.0922' stroke='#787878' stroke-width='0.246944' stroke-linecap='round'/>
<rect class='terminal' id='connector0terminal' x='0.123472' y='1.0922' width='0.0001' height='0.0001' stroke='none' stroke-width='0' fill='none'/>
<text class='text' font-family="'Droid Sans'" stroke='none' stroke-width='0' fill='#8c8c8c' font-size='0.881944' x='1.39347' y='0.721784' text-anchor='middle'>1</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -1 +1,13 @@
# Affiche l'horaire du train Cheseaux à Lausanne sur un ruban de LED's RGB
zf190408.2100
## ATTENTION, cela ne fonctionne pas encore !
## Ce n'est pas encore automatique, il faut lancer à la main boot.lua et timetable.Lausanne
## Il y a un problème d'arrondi dans le calcul du nombre de 3 minutes, il ne faut pas arrondir 2mn31 à 3 minutes !<br>
Si c'est < 3 minutes il faut décompte moins un pour les clignotements car même pour 10 secondes on va rater le train !
## Il y a un très gros problème de raisonnement, car quand on se trouve entre -1 et 3 minutes du prochain train, l'horaire du train, que l'on va chercher sur Internet, ne va changer qu'une minute après le départ du train. Il faut donc prendre le prochain train indiqué et non le train actuel quand on se trouve à < 3 minutes du départ !
## A cause du problème de raisonnement, cela boucle en continu quand on se trouve entre -1 et 3 minutes du départ du train !

View File

@@ -2,7 +2,7 @@
-- tout sur la couleur: https://www.w3schools.com/colors/default.asp
-- roue des couleurs: https://iro.js.org/?ref=oldsite
print("\n jflash_2rgb.lua jv190227.1628 \n")
print("\n jflash_2rgb.lua jv190408.1815 \n")
dofile("jled_rgb.lua")
@@ -19,7 +19,7 @@ ztmr_Flash_LED1 = tmr.create() ztmr_Flash_LED2 = tmr.create()
function flash_LED1 ()
if nbfois1 >= xfois1 then
print(nbfois1)
print("nbfois1: "..nbfois1)
nbfois1 = 0
jled_rgb(zLED1,R1,G1,B1,0)
tmr.alarm(ztmr_Flash_LED1, zTm_Pause, tmr.ALARM_SINGLE, flash_LED1)
@@ -39,7 +39,7 @@ end
function flash_LED2 ()
if nbfois2 >= xfois2 then
print(nbfois2)
print("nbfois2: "..nbfois2)
nbfois2 = 0
jled_rgb(zLED2,R2,G2,B2,0)
tmr.alarm(ztmr_Flash_LED2, zTm_Pause, tmr.ALARM_SINGLE, flash_LED2)
@@ -57,9 +57,9 @@ function flash_LED2 ()
end
end
xfois1 =5
xfois1 = 5
flash_LED1 ()
xfois2 =2
xfois2 = 2
flash_LED2 ()

View File

@@ -0,0 +1,80 @@
-- Rafraichissement du diff time et du web_cli
print("\n time_table.lua aj190408.1924 \n")
function get_timetable()
-- http.get("http://192.168.4.1/?line1="..zlength.."m", nil, function(code, data)
print("get_timetable: ")
http.get("http://transport.opendata.ch/v1/connections?from=Cheseaux&to=Lausanne-Flon&fields[]=connections/from/departure", nil, function(code, data)
if (code < 0) then
print("HTTP request failed")
else
print(code, data)
jp= 50 h1=string.sub (data,jp,jp+7)
jp= 100 h2=string.sub (data,jp,jp+7)
jp= 150 h3=string.sub (data,jp,jp+7)
jp= 200 h4=string.sub (data,jp,jp+7)
print(h1,h2,h3,h4)
refresh_display()
end
end)
end
function refresh_display()
print("coucou 1")
-- tm = rtctime.epoch2cal(rtctime.get() + 3600) -- heure d'été
tm = rtctime.epoch2cal(rtctime.get() + 7200) -- heure d'hiver
h0 = string.format("%02d:%02d:%02d", tm["hour"], tm["min"], tm["sec"])
print("Il est "..h0)
print("h2, h3",h2,h3)
d1=zround((diff_time(h2, h0)/180),0)
d2=zround((diff_time(h3, h0)/180),0)
print(d1,d2)
xfois1 = d2 xfois2 =d1
if d1==0 then
print("coucou 2")
get_timetable()
print("coucou 3")
-- refresh_display()
print("coucou 4")
end
end
function start_refresh_display()
tm = rtctime.epoch2cal(rtctime.get() + 7200)
h0 = string.format("%02d:%02d:%02d", tm["hour"], tm["min"], tm["sec"])
print("Il est "..h0)
tm = time2sec(h0)
print("tm: ",tm)
if tm >= 71000 then
ztmr_start_refresh_display:unregister()
get_timetable()
-- refresh_display()
end
end
zTm_start_refresh_display = 1*1000
ztmr_start_refresh_display = tmr.create()
tmr.alarm(ztmr_start_refresh_display, zTm_start_refresh_display, tmr.ALARM_AUTO, start_refresh_display)
zTm_refresh_display = 10*1000
ztmr_refresh_display = tmr.create()
--get_timetable()
--refresh_display()
--tmr.alarm(ztmr_refresh_display, zTm_refresh_display, tmr.ALARM_AUTO, refresh_display)
--[[
get_timetable()
refresh_display()
]]

View File

@@ -1,5 +1,5 @@
-- Petit script pour envoyer quelque chose sur un serveur WEB
print("\n web_cli.lua zf190227.1838 \n")
print("\n web_cli.lua zf190408.1823 \n")
function disp_send()
@@ -15,8 +15,11 @@ function disp_send()
jp= 150 h3=string.sub (data,jp,jp+7)
jp= 200 h4=string.sub (data,jp,jp+7)
print(h1,h2,h3,h4)
tm = rtctime.epoch2cal(rtctime.get() + 3600)
-- tm = rtctime.epoch2cal(rtctime.get() + 3600) -- heure d'été
tm = rtctime.epoch2cal(rtctime.get() + 7200) -- heure d'hiver
h0 = string.format("%02d:%02d:%02d", tm["hour"], tm["min"], tm["sec"])
print("Il est "..h0)
d1=zround((diff_time(h2, h0)/180),0)
d2=zround((diff_time(h3, h0)/180),0)
print(d1,d2)
@@ -34,4 +37,4 @@ h0 = string.format("%02d:%02d:%02d", tm["hour"], tm["min"], tm["sec"])
print(h0)
]]
]]

View File

@@ -1,9 +1,12 @@
-- Petit script pour configurer le client WIFI du NodeMCU
print("\n wifi_cli_conf.lua zf190227.1723 \n")
print("\n wifi_cli_conf.lua zf190408.1953 \n")
--credentials par défaut
--cli_ssid="3g-s7"
cli_ssid="AlexIphone"
cli_pwd="q1w2abcdfH&"
cli_ssid="3g-s7"
cli_pwd="12234567"