Skip to content

Instantly share code, notes, and snippets.

@barzik
Created January 28, 2022 17:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save barzik/1184031bbad7e999f10c8b4d3cd1f10b to your computer and use it in GitHub Desktop.
[
{
"id": "a48e0b927d58bcd2",
"type": "tab",
"label": "Wordle Generator",
"disabled": false,
"info": "",
"env": []
},
{
"id": "e3cbf63d9493758d",
"type": "rpi-sensehat out",
"z": "a48e0b927d58bcd2",
"name": "",
"x": 750,
"y": 360,
"wires": []
},
{
"id": "4b62f2dd53faf805",
"type": "function",
"z": "a48e0b927d58bcd2",
"name": "Turn off",
"func": "msg.payload = '*,*,off';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 560,
"y": 600,
"wires": [
[
"e3cbf63d9493758d"
]
]
},
{
"id": "1148172988d8baae",
"type": "inject",
"z": "a48e0b927d58bcd2",
"name": "Turn off",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 330,
"y": 600,
"wires": [
[
"4b62f2dd53faf805"
]
]
},
{
"id": "506e783574613fc4",
"type": "debug",
"z": "a48e0b927d58bcd2",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 550,
"y": 500,
"wires": []
},
{
"id": "d3b4894153b6abdc",
"type": "inject",
"z": "a48e0b927d58bcd2",
"name": "Turn on",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[\"⬜⬜⬜⬜⬜\",\"⬜⬜🟨🟨⬜\",\"🟨🟨⬜🟨🟨\",\"🟨🟩🟨🟩⬜\",\"🟩🟩🟩🟩🟩\"]",
"payloadType": "json",
"x": 150,
"y": 360,
"wires": [
[
"5c3cabda3c644f31",
"f1f5caecc02bfb96"
]
]
},
{
"id": "5c3cabda3c644f31",
"type": "function",
"z": "a48e0b927d58bcd2",
"name": "Translate ⬛🟨🟩 to pixels",
"func": "let payload = msg.payload;\nnode.log(payload);\nlet InputString = '';\n\nlet buildLines = (emojiArray, Yaxis) => {\n let YAxis = Yaxis+1;\n emojiArray = [...emojiArray];\n emojiArray.forEach((element, index) => {\n utfCode = element.codePointAt(0).toString(16)\n let color = 'gray';\n switch(utfCode) {\n case '1f7e9': \n color = 'green';\n break;\n case '1f7e8':\n color = 'yellow';\n break;\n default:\n color = 'gray';\n break;\n }\n InputString += `${index+1},${YAxis},${color},`;\n });\n}\n\npayload.forEach((emojiArray, Yaxis) => {\n buildLines(emojiArray, Yaxis);\n});\n\nmsg.payload = InputString.slice(0, -1);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 360,
"wires": [
[
"506e783574613fc4",
"e3cbf63d9493758d"
]
]
},
{
"id": "f1f5caecc02bfb96",
"type": "function",
"z": "a48e0b927d58bcd2",
"name": "Build frame",
"func": "\nmsg.payload = \"0-7,0,purple,0-7,7,purple,0,0-7,purple,7,0-7,purple\";\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 200,
"wires": [
[
"e3cbf63d9493758d"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment