var sliderMin = 0; var sliderMax = 20; var sliderStep = 1; var sliderValue = 0; function initialize_webiopi(){ applyCustomCss('styles.css'); webiopi().refreshGPIO(false); } function toggleLED(gpio){ var changeButtonColor = function(macro, args, response){ if(response){ document.getElementById("gpio"+gpio).className = "HIGH"; }else{ document.getElementById("gpio"+gpio).className = "LOW"; } } webiopi().callMacro("toggleLED", [gpio], changeButtonColor); } $(function() { var sliderHandler1 = function(e, ui){ var ratio = ui.value/sliderMax; webiopi().pulseRatio(18, ratio); }; $( "#slider1" ).slider({ min: sliderMin, max: sliderMax, step: sliderStep, value: sliderValue, change: sliderHandler1, slide: sliderHandler1 }); }); function applyCustomCss(custom_css){ var head = document.getElementsByTagName('head')[0]; var style = document.createElement('link'); style.rel = "stylesheet"; style.type = 'text/css'; style.href = custom_css; head.appendChild(style); }