Shraddha Phuge
Published © GPL3+

Controlling the intensity of led using IOT BOLT & SmartPhone

This project helps us to increase or decrease the intensity of light by using iot bolt.

BeginnerProtip3 hours559
Controlling the intensity of led using IOT BOLT & SmartPhone

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×2
LED (generic)
LED (generic)
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Bolt IoT Android App
Bolt IoT Android App
Bolt Cloud
Bolt IoT Bolt Cloud

Story

Read more

Schematics

Circuit diagram of this system

Code

Coding part to change the intensity of light.

HTML
Now moving to the coding part of the System.
1.Create a html file (.html).
2. Name that html file "light_intensity.html"
3.Type the below code and save it.
<html>
    <head>
        <title>Bolt IoT Platform</title>
        <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
        <script>
        setKey('{{ApiKey}}','{{Name}}');
        var last_pwm_value=-1;
        function updateBuzzer(){
            var pwm_value=document.getElementById('pwm_value').value;
            if(last_pwm_value!=pwm_value){
                analogWrite(0,pwm_value);
                document.getElementById('pwm_value_display').innerHTML=pwm_value;
            }
            last_pwm_value=pwm_value;
        }
        setInterval(updateBuzzer,1000);
        </script>
    </head>
    <body>
        pwm value:
        <input type='range' id='pwm_value' min="0" max="255" value="0">
        <div id='pwm_value_display'>0</div>
    </body>
</html>

Credits

Shraddha Phuge

Shraddha Phuge

1 project • 0 followers

Comments