-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKontrol LED Strip.json
1 lines (1 loc) · 2.53 KB
/
Kontrol LED Strip.json
1
{"files":[{"id":"0932440a-3503-4f5c-a1ea-163eea15b9c5","name":"appsscript","type":"json","source":"{\n \"timeZone\": \"Asia/Jakarta\",\n \"dependencies\": {},\n \"exceptionLogging\": \"STACKDRIVER\",\n \"runtimeVersion\": \"V8\",\n \"webapp\": {\n \"executeAs\": \"USER_DEPLOYING\",\n \"access\": \"MYSELF\"\n }\n}"},{"id":"be9ef924-e955-41fa-94f0-93f346adadb4","name":"Kode","type":"server_js","source":"function doGet(e) {\n return HtmlService.createHtmlOutputFromFile(\u0027Index\u0027);\n}\n\nfunction controlLED(action) {\n var url \u003d \"http://\u003cESP32_IP\u003e/control?\" + action;\n var response \u003d UrlFetchApp.fetch(url);\n return response.getContentText();\n}\n"},{"id":"eecf49c5-9184-4057-96d2-e68570d0b6c6","name":"Index","type":"html","source":"\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n \u003chead\u003e\n \u003cbase target\u003d\"_top\"\u003e\n \u003cscript\u003e\n function controlLED(action) {\n google.script.run.withSuccessHandler(function(response) {\n document.getElementById(\u0027status\u0027).innerText \u003d response;\n }).controlLED(action);\n }\n\n function toggleLED() {\n controlLED(\u0027toggle\u003dtrue\u0027);\n }\n\n function setColor() {\n var color \u003d document.getElementById(\u0027colorPicker\u0027).value;\n controlLED(\u0027color\u003d\u0027 + color);\n }\n\n function setEffect() {\n var effect \u003d document.getElementById(\u0027effectPicker\u0027).value;\n controlLED(\u0027effect\u003d\u0027 + effect);\n }\n \u003c/script\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003ch1\u003eKontrol LED Strip RGB\u003c/h1\u003e\n \u003cbutton onclick\u003d\"toggleLED()\"\u003eToggle LED\u003c/button\u003e\n \u003cbr\u003e\u003cbr\u003e\n \u003cinput type\u003d\"color\" id\u003d\"colorPicker\" onchange\u003d\"setColor()\" value\u003d\"#ffffff\"\u003e\n \u003clabel for\u003d\"colorPicker\"\u003ePilih Warna\u003c/label\u003e\n \u003cbr\u003e\u003cbr\u003e\n \u003cselect id\u003d\"effectPicker\" onchange\u003d\"setEffect()\"\u003e\n \u003coption value\u003d\"0\"\u003eNo Effect\u003c/option\u003e\n \u003coption value\u003d\"1\"\u003eFlow Effect\u003c/option\u003e\n \u003coption value\u003d\"2\"\u003eWave Effect\u003c/option\u003e\n \u003c/select\u003e\n \u003clabel for\u003d\"effectPicker\"\u003ePilih Efek\u003c/label\u003e\n \u003cbr\u003e\u003cbr\u003e\n \u003cdiv id\u003d\"status\"\u003e\u003c/div\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n"}]}