Outils pour utilisateurs

Outils du site


start:raspberry:nodered:compteurs

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
start:raspberry:nodered:compteurs [2024/05/23 21:19] – [la fonction :] gerardadminstart:raspberry:nodered:compteurs [2024/05/23 21:25] (Version actuelle) – [les nœuds à importer pour essais:] gerardadmin
Ligne 8: Ligne 8:
  
  
-{{ :start:raspberry:nodered:capture_d_ecran_du_2024-05-23_20-58-21.png?direct&600 |}}+{{ :start:raspberry:nodered:capture_d_ecran_du_2024-05-23_20-58-21.png?direct&800 |}} 
  
-{{ :start:raspberry:nodered:compteur1_essai_flows.json.zip |}} 
  
  
 ==== la fonction : ==== ==== la fonction : ====
  
 +<code javascript fonction.js>
 var compteur1 = flow.get("compteur1") || 0 var compteur1 = flow.get("compteur1") || 0
 compteur1++ compteur1++
Ligne 24: Ligne 25:
 msg.payload = compteur1 msg.payload = compteur1
 return msg; return msg;
 +</code>
 +
  
  
 ==== les nœuds à importer pour essais: ==== ==== les nœuds à importer pour essais: ====
  
-<code txt compteur.js>+{{ :start:raspberry:nodered:compteur1_essai_flows.json.zip |}} 
 + 
 +<code javascript compteur.js>
  
 [ { "id": "745389f46bba8f47", "type": "inject", "z": "968dc7d3a4ac9207", "name": "+1", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 190, "y": 500, "wires": [ [ "79a0decfbb064151" ] ] }, { "id": "79a0decfbb064151", "type": "function", "z": "968dc7d3a4ac9207", "name": "function 6", "func": "var compteur1 = flow.get(\"compteur1\") || 0\ncompteur1++\nif (compteur1 === 6)\n{\n compteur1 = 0;\n}\nflow.set(\"compteur1\",compteur1)\nmsg.payload = compteur1\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 440, "y": 500, "wires": [ [ "b8e4eebc720c258b", "4910c8c53a1e402a" ] ] }, { "id": "b8e4eebc720c258b", "type": "debug", "z": "968dc7d3a4ac9207", "name": "debug 56", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 700, "y": 500, "wires": [] }, { "id": "3cb31948362869ec", "type": "inject", "z": "968dc7d3a4ac9207", "name": "Remise à Zero", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 200, "y": 580, "wires": [ [ "71bb8df28449e565" ] ] }, { "id": "71bb8df28449e565", "type": "change", "z": "968dc7d3a4ac9207", "name": "", "rules": [ { "t": "set", "p": "compteur1", "pt": "flow", "to": "0", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 460, "y": 580, "wires": [ [ "79a0decfbb064151" ] ] }, { "id": "4910c8c53a1e402a", "type": "ui_text", "z": "968dc7d3a4ac9207", "group": "7d39b6925b5fda69", "order": 4, "width": 0, "height": 0, "name": "", "label": "Compteur1", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 710, "y": 440, "wires": [] }, { "id": "83e4d61a37937888", "type": "ui_button", "z": "968dc7d3a4ac9207", "name": "", "group": "7d39b6925b5fda69", "order": 5, "width": 0, "height": 0, "passthru": false, "label": "bouton +1", "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "payload": "1", "payloadType": "str", "topic": "topic", "topicType": "msg", "x": 180, "y": 540, "wires": [ [ "79a0decfbb064151" ] ] }, { "id": "7d39b6925b5fda69", "type": "ui_group", "name": "Default", "tab": "8b1ceed22ac65836", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "8b1ceed22ac65836", "type": "ui_tab", "name": "compteurs", "icon": "dashboard", "order": 1, "disabled": false, "hidden": false } ] [ { "id": "745389f46bba8f47", "type": "inject", "z": "968dc7d3a4ac9207", "name": "+1", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 190, "y": 500, "wires": [ [ "79a0decfbb064151" ] ] }, { "id": "79a0decfbb064151", "type": "function", "z": "968dc7d3a4ac9207", "name": "function 6", "func": "var compteur1 = flow.get(\"compteur1\") || 0\ncompteur1++\nif (compteur1 === 6)\n{\n compteur1 = 0;\n}\nflow.set(\"compteur1\",compteur1)\nmsg.payload = compteur1\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 440, "y": 500, "wires": [ [ "b8e4eebc720c258b", "4910c8c53a1e402a" ] ] }, { "id": "b8e4eebc720c258b", "type": "debug", "z": "968dc7d3a4ac9207", "name": "debug 56", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 700, "y": 500, "wires": [] }, { "id": "3cb31948362869ec", "type": "inject", "z": "968dc7d3a4ac9207", "name": "Remise à Zero", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 200, "y": 580, "wires": [ [ "71bb8df28449e565" ] ] }, { "id": "71bb8df28449e565", "type": "change", "z": "968dc7d3a4ac9207", "name": "", "rules": [ { "t": "set", "p": "compteur1", "pt": "flow", "to": "0", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 460, "y": 580, "wires": [ [ "79a0decfbb064151" ] ] }, { "id": "4910c8c53a1e402a", "type": "ui_text", "z": "968dc7d3a4ac9207", "group": "7d39b6925b5fda69", "order": 4, "width": 0, "height": 0, "name": "", "label": "Compteur1", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 710, "y": 440, "wires": [] }, { "id": "83e4d61a37937888", "type": "ui_button", "z": "968dc7d3a4ac9207", "name": "", "group": "7d39b6925b5fda69", "order": 5, "width": 0, "height": 0, "passthru": false, "label": "bouton +1", "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "", "payload": "1", "payloadType": "str", "topic": "topic", "topicType": "msg", "x": 180, "y": 540, "wires": [ [ "79a0decfbb064151" ] ] }, { "id": "7d39b6925b5fda69", "type": "ui_group", "name": "Default", "tab": "8b1ceed22ac65836", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "8b1ceed22ac65836", "type": "ui_tab", "name": "compteurs", "icon": "dashboard", "order": 1, "disabled": false, "hidden": false } ]
Ligne 41: Ligne 46:
  
  
-Capture d’écran du 2024-05-23 20-58-38.png 
  
-Capture d’écran du 2024-05-23 20-58-21.png 
  
/home/chanteri/www/fablab37110/data/attic/start/raspberry/nodered/compteurs.1716491965.txt.gz · Dernière modification : 2024/05/23 21:19 de gerardadmin