RaspberryPiWorkshopEinsteiger: Unterschied zwischen den Versionen

Aus FabLab Rothenburg
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
Ein paar Informationen zum Raspberry Pi Workshop für Einsteiger.
Ergänzende Informationen zum Raspberry Pi Workshop für Einsteiger.
 
Links
 
https://www.raspberrypi.org/help/noobs-setup/
 
https://downloads.raspberrypi.org/NOOBS_latest
 
https://wiki.ubuntuusers.de/verzeichnisstruktur
 
http://gitlab.brokenpipe.de/jochen/webiopi.git
 
http://wiringpi.com/the-gpio-utility
 
http://wiringpi.com/pins/
 
http://jochenpi.fablab-rothenburg.de:8000/
 
http://raspberrypi.local:8000/
 
http://jochenpi.fablab-rothenburg.de:1880/
 
http://raspberrypi.local:1880/
 
http://nodered.org/
 
http://flows.nodered.org/
 
 


Node-RED Flow
Node-RED Flow

Version vom 23. Januar 2016, 11:36 Uhr

Ergänzende Informationen zum Raspberry Pi Workshop für Einsteiger.

Links

https://www.raspberrypi.org/help/noobs-setup/

https://downloads.raspberrypi.org/NOOBS_latest

https://wiki.ubuntuusers.de/verzeichnisstruktur

http://gitlab.brokenpipe.de/jochen/webiopi.git

http://wiringpi.com/the-gpio-utility

http://wiringpi.com/pins/

http://jochenpi.fablab-rothenburg.de:8000/

http://raspberrypi.local:8000/

http://jochenpi.fablab-rothenburg.de:1880/

http://raspberrypi.local:1880/

http://nodered.org/

http://flows.nodered.org/


Node-RED Flow

Lichtschalter:

[{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.331698","name":"Lichtschalter","func":"context.state = context.state || 0;\n//nachricht = Object.create(msg);\n//schalter = Object.create(msg);\n\nif (msg.payload.state) {\n    if (msg.payload.state == \"toggle\") {\n        (context.state == 0) ? context.state = 1 : context.state = 0;\n    }\n    if (msg.payload.state == \"on\") {\n        context.state = 0;\n    }\n    if (msg.payload.state == \"off\") {\n        context.state = 1;\n    }\n}\nif (context.state == 0)\n    msg.text = \"on\"\nif (context.state == 1)\n    msg.text = \"off\"\nmsg.payload = context.state;\n\nreturn msg;","outputs":"1","noerr":0,"x":439,"y":441,"wires":[["a0846992.5f7b98","d861ecaa.279e1","24b4eac5.db4b16"]]}]

Schalterstatus:

[{"id":"24b4eac5.db4b16","type":"function","z":"cce966b8.331698","name":"Schalterstatus","func":"if (msg.payload == 1) \n    msg.payload = \"off\"\nif (msg.payload == 0) \n    msg.payload = \"on\"\n\nreturn msg;","outputs":"1","noerr":0,"x":582,"y":520,"wires":[["12dc73d7.ed238c","2981565a.d67eaa"]]}]

Lichttemplate:

[{"id":"12dc73d7.ed238c","type":"template","z":"cce966b8.331698","name":"Lichttemplate","field":"","template":"Licht: {{ payload }}","x":748,"y":520,"wires":[["69b1560f.964ea8"]]}]


Komplett incl. Debug:

[{"id":"d861ecaa.279e1","type":"rpi-gpio out","z":"cce966b8.331698","name":"Plasmakugel","pin":"5","set":"","level":"0","out":"out","x":647,"y":289,"wires":[]},{"id":"b80debab.47f218","type":"debug","z":"cce966b8.331698","name":"","active":false,"x":437,"y":399,"wires":[]},{"id":"df1d5ea3.20e2a","type":"inject","z":"cce966b8.331698","name":"","topic":"","payload":"toggle","payloadType":"string","repeat":"","crontab":"","once":false,"x":115,"y":514,"wires":[["25878f59.da787","156d0c37.ea92f4"]]},{"id":"ff1805cc.00e7f8","type":"http in","z":"cce966b8.331698","name":"","url":"/licht","method":"get","swaggerDoc":"","x":104,"y":390,"wires":[["163cbf6c.e9c341"]]},{"id":"69b1560f.964ea8","type":"http response","z":"cce966b8.331698","name":"","x":883,"y":518,"wires":[]},{"id":"163cbf6c.e9c341","type":"node-red-contrib-httpauth","z":"cce966b8.331698","name":"","file":"","cred":"","authType":"Basic","realm":"licht","username":"jochen","password":"foobar","hashed":false,"x":264,"y":357,"wires":[["b80debab.47f218","48a6df2a.b7592"]]},{"id":"12dc73d7.ed238c","type":"template","z":"cce966b8.331698","name":"Lichttemplate","field":"","template":"Licht: {{ payload }}","x":748,"y":520,"wires":[["69b1560f.964ea8"]]},{"id":"48a6df2a.b7592","type":"function","z":"cce966b8.331698","name":"Lichtschalter","func":"context.state = context.state || 0;\n//nachricht = Object.create(msg);\n//schalter = Object.create(msg);\n\nif (msg.payload.state) {\n    if (msg.payload.state == \"toggle\") {\n        (context.state == 0) ? context.state = 1 : context.state = 0;\n    }\n    if (msg.payload.state == \"on\") {\n        context.state = 0;\n    }\n    if (msg.payload.state == \"off\") {\n        context.state = 1;\n    }\n}\nif (context.state == 0)\n    msg.text = \"on\"\nif (context.state == 1)\n    msg.text = \"off\"\nmsg.payload = context.state;\n\nreturn msg;","outputs":"1","noerr":0,"x":439,"y":441,"wires":[["a0846992.5f7b98","d861ecaa.279e1","24b4eac5.db4b16"]]},{"id":"a0846992.5f7b98","type":"debug","z":"cce966b8.331698","name":"","active":false,"console":"false","complete":"payload","x":645,"y":251,"wires":[]},{"id":"24b4eac5.db4b16","type":"function","z":"cce966b8.331698","name":"Schalterstatus","func":"if (msg.payload == 1) \n    msg.payload = \"off\"\nif (msg.payload == 0) \n    msg.payload = \"on\"\n\nreturn msg;","outputs":"1","noerr":0,"x":582,"y":520,"wires":[["12dc73d7.ed238c","2981565a.d67eaa"]]},{"id":"2981565a.d67eaa","type":"debug","z":"cce966b8.331698","name":"","active":false,"console":"false","complete":"payload","x":747,"y":481,"wires":[]},{"id":"25878f59.da787","type":"debug","z":"cce966b8.331698","name":"","active":false,"x":266,"y":519,"wires":[]},{"id":"156d0c37.ea92f4","type":"function","z":"cce966b8.331698","name":"payload convert","func":"msg.payload = { \"state\": msg.payload };\nreturn msg;","outputs":1,"noerr":0,"x":273,"y":481,"wires":[["48a6df2a.b7592"]]}]