Skip to content

Instantly share code, notes, and snippets.

@jirikrepl
Created March 15, 2018 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jirikrepl/884f6bbb23660777ab1cd23813332740 to your computer and use it in GitHub Desktop.
Save jirikrepl/884f6bbb23660777ab1cd23813332740 to your computer and use it in GitHub Desktop.
# SEND VIRTUAL VALUE
# # You can currently send Strings, Int32, Float32 and Tuples to pybytes using this method.
# # Soon you will be able to send Coordinates, Longs, Unsigned numerical types, and more.
# pybytes.send_virtual_pin_value(False, 26, 'The device restarted')
#
# # SEND SENSOR DATA THROUGH VIRTUAL PINS
# # If you use a Pysense, some libraries are necessary to access its sensors
# # you can find them here: https://github.com/pycom/pycom-libraries
#
# # Include the libraries in the lib folder then import the ones you want to use here:
# from SI7006A20 import SI7006A20
# si = SI7006A20()
# from LTR329ALS01 import LTR329ALS01
# ltr = LTR329ALS01()
#
# # Import what is necessary to create a thread
# import _thread
# from time import sleep
#
# # Define your thread's behavior, here it's a loop sending sensors data every 10 seconds
# def send_env_data():
# while (pybytes):
# pybytes.send_virtual_pin_value(False, 24, si.humidity())
# pybytes.send_virtual_pin_value(False, 25, si.temperature())
# pybytes.send_virtual_pin_value(False, 23, ltr.light());
# sleep(10)
#
# # Start your thread
# _thread.start_new_thread(send_env_data, ())
#
# # you can use the print method to write something in Pymaker's console, to check
# # if the device executed normally all the code preceding this print(), for example.
# print('The device started properly')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment