-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from tomekmalek/master
Implementation of example with VL6180X sensor
- Loading branch information
Showing
12 changed files
with
609 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# Copyright (C) Orange | ||
# | ||
# This software is distributed under the terms and conditions of the 'MIT' | ||
# license which can be found in the file 'LICENSE.md' in this package distribution | ||
import sys | ||
import time | ||
import LiveObjects | ||
|
||
# Create LiveObjects | ||
lo = LiveObjects.Connection() | ||
sensor = LiveObjects.SensorVL6180X() | ||
|
||
MESSAGE_RATE = 5 | ||
|
||
# Main program | ||
lo.connect() # Connect to LiveObjects | ||
last = uptime = time.time() | ||
|
||
while True: | ||
if (time.time()) >= last + MESSAGE_RATE: | ||
lo.add_to_payload("distance", sensor.range) | ||
lo.add_to_payload("ambient_light", sensor.amb_light()) | ||
lo.send_data() # Sending data to cloud | ||
last = time.time() | ||
lo.loop() # Check for incoming messages and if connection is still active |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.