florianMayank Joneja
Published © GPL3+

Bolt IoT Demo und Türüberwachung in Deutsch

Bolt IoT ist eine neue Plattform für IoT. Hier stelle ich die Plattform vor und teste, wie schnell sich coole Dinge umsetzen lassen.

IntermediateProtip2 hours466
Bolt IoT Demo und Türüberwachung in Deutsch

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Android device
Android device
×1
Any other components you like
×1
IR Obstacle Avoidance Sensor
×1
LED (generic)
LED (generic)
×2

Software apps and online services

Bolt IoT Android App
Browser
Bolt IoT Cloud

Story

Read more

Code

Bolt Tuerueberwachung Script

Python
#!/usr/bin/env python
import time
import re
from boltiot import Bolt
api_key = "your_api_key"
device_id = "BOLT3432153"
upper_limit = 1000
mybolt = Bolt(api_key, device_id)
while(1):
  time.sleep(1)
  response = mybolt.analogRead('A0').split(",")
  if response[0] == '{"success": "1"': #Das format ist nicht gut...
	  m = re.search('\d+', response[1])
	  if m:
	    if int(m.group(0)) > upper_limit:
	      print "Die Tuer ist auf"
	    else:
	      print "Die Tuer ist zu"
	      

Hello World

HTML
<html>
<head>
  <!-- In following  line will load the boltCommands.js files from Bolt cloud.-->
  <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js">
  </script>

  <script type="text/javascript">
    // The following line will set the api key and device name. It will be auto-initialized by Bolt cloud.
    setKey('{{ApiKey}}','{{Name}}');
</script>

</head>
<body>
<center>
  <!-- In below line, We are calling the digitalWrite function from  boltCommands.js file to switch on the LED. -->
  <button onclick="digitalWrite(0, 'HIGH');">ON</button>
  <button onclick="digitalWrite(1, 'HIGH');">ON1</button>

  <!-- In below line, we are calling the digitalWrite function from boltCommands.js file to switch off the LED. -->
  <button onclick="digitalWrite(0, 'LOW');">OFF</button>
  <button onclick="digitalWrite(1, 'LOW');">OFF1</button>

</center>
</body>
</html>

Credits

florian

florian

1 project • 3 followers
Mayank Joneja

Mayank Joneja

6 projects • 42 followers
Embedded Hardware Development and Robotics. Networked Embedded Systems | IoT | Wireless Sensor Networks | Design Thinking

Comments