Imagine if you are outside and forgot your light switched on back at home. then, in this case you can switch off your lights from your laptop in office and save electricity.
Hardware connection:
1.Take one leg of the resistor and wrap it around the longer leg of the LED i.e positive leg.
2.Insert the negative leg of the LED into the ground pin of the Bolt.
3.Insert the other leg of the resistor in digital pin 0 of the Bolt.
Steps for controlling Led :
1. Go to cloud.boltiot.com and create a new product. Select output device and Gpio then configure.
2.Move to the code tab and write the following code
3. Complete Code:
<!DOCTYPE html>
<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}}');
</script>
</head>
<body>
<center>
<button onclick="digitalWrite(0, 'HIGH');">ON</button>
<button onclick="digitalWrite(0, 'LOW');">OFF</button>
</center>
</body>
</html>
4. Give a name to file and HTML extension.
5. Save it. Click on link icon and select bolt device.
6. Now you can view your html page to control led.
Comments