|
45 | 45 | if 'pybytes' not in globals().keys():
|
46 | 46 | pybytes = Pybytes(pybytes_config, pybytes_config.get('cfg_msg') is None, True)
|
47 | 47 |
|
48 |
| - # Please put your USER code below this line |
| 48 | + # Please put your USER code below this line |
49 | 49 |
|
50 |
| - # SEND SIGNAL |
51 |
| - # You can currently send Strings, Int32, Float32 and Tuples to pybytes using this method. |
52 |
| - # pybytes.send_signal(signalNumber, value) |
| 50 | + # SEND SIGNAL |
| 51 | + # You can currently send Strings, Int32, Float32 and Tuples to pybytes using this method. |
| 52 | + # pybytes.send_signal(signalNumber, value) |
53 | 53 |
|
54 |
| - # SEND SENSOR DATA THROUGH SIGNALS |
55 |
| - # # If you use a Pysense, some libraries are necessary to access its sensors |
56 |
| - # # you can find them here: https://github.com/pycom/pycom-libraries |
57 |
| - # |
58 |
| - # # Include the libraries in the lib folder then import the ones you want to use here: |
59 |
| - # from SI7006A20 import SI7006A20 |
60 |
| - # si = SI7006A20() |
61 |
| - # from LTR329ALS01 import LTR329ALS01 |
62 |
| - # ltr = LTR329ALS01() |
63 |
| - # |
64 |
| - # # Import what is necessary to create a thread |
65 |
| - # import _thread |
66 |
| - # from time import sleep |
67 |
| - # from machine import Pin |
68 |
| - # |
69 |
| - # # Define your thread's behaviour, here it's a loop sending sensors data every 10 seconds |
70 |
| - # def send_env_data(): |
71 |
| - # while (pybytes): |
72 |
| - # pybytes.send_signal(1, si.humidity()) |
73 |
| - # pybytes.send_signal(2, si.temperature()) |
74 |
| - # pybytes.send_signal(3, ltr.light()); |
75 |
| - # sleep(10) |
76 |
| - # |
77 |
| - # # Start your thread |
78 |
| - # _thread.start_new_thread(send_env_data, ()) |
| 54 | + # SEND SENSOR DATA THROUGH SIGNALS |
| 55 | + # # If you use a Pysense, some libraries are necessary to access its sensors |
| 56 | + # # you can find them here: https://github.com/pycom/pycom-libraries |
| 57 | + # |
| 58 | + # # Include the libraries in the lib folder then import the ones you want to use here: |
| 59 | + # from SI7006A20 import SI7006A20 |
| 60 | + # si = SI7006A20() |
| 61 | + # from LTR329ALS01 import LTR329ALS01 |
| 62 | + # ltr = LTR329ALS01() |
| 63 | + # |
| 64 | + # # Import what is necessary to create a thread |
| 65 | + # import _thread |
| 66 | + # from time import sleep |
| 67 | + # from machine import Pin |
| 68 | + # |
| 69 | + # # Define your thread's behaviour, here it's a loop sending sensors data every 10 seconds |
| 70 | + # def send_env_data(): |
| 71 | + # while (pybytes): |
| 72 | + # pybytes.send_signal(1, si.humidity()) |
| 73 | + # pybytes.send_signal(2, si.temperature()) |
| 74 | + # pybytes.send_signal(3, ltr.light()); |
| 75 | + # sleep(10) |
| 76 | + # |
| 77 | + # # Start your thread |
| 78 | + # _thread.start_new_thread(send_env_data, ()) |
79 | 79 |
|
80 |
| - # SET THE BATTERY LEVEL |
81 |
| - # pybytes.send_battery_level(23) |
| 80 | + # SET THE BATTERY LEVEL |
| 81 | + # pybytes.send_battery_level(23) |
82 | 82 |
|
83 |
| - # SEND DIGITAL VALUE |
84 |
| - # pybytes.send_digital_pin_value(False, 12, Pin.PULL_UP) |
| 83 | + # SEND DIGITAL VALUE |
| 84 | + # pybytes.send_digital_pin_value(False, 12, Pin.PULL_UP) |
85 | 85 |
|
86 |
| - # SEND ANALOG VALUE |
87 |
| - # pybytes.send_analog_pin_value(False, 13) |
| 86 | + # SEND ANALOG VALUE |
| 87 | + # pybytes.send_analog_pin_value(False, 13) |
88 | 88 |
|
89 |
| - # REGISTER PERIODICAL DIGIAL VALUE SEND |
90 |
| - # pybytes.register_periodical_digital_pin_publish(False, PIN_NUMBER, Pin.PULL_UP, INTERVAL_SECONDS) |
| 89 | + # REGISTER PERIODICAL DIGIAL VALUE SEND |
| 90 | + # pybytes.register_periodical_digital_pin_publish(False, PIN_NUMBER, Pin.PULL_UP, INTERVAL_SECONDS) |
91 | 91 |
|
92 |
| - # REGISTER PERIODICAL ANALOG VALUE SEND |
93 |
| - # pybytes.register_periodical_analog_pin_publish(False, PIN_NUMBER, INTERVAL_SECONDS) |
| 92 | + # REGISTER PERIODICAL ANALOG VALUE SEND |
| 93 | + # pybytes.register_periodical_analog_pin_publish(False, PIN_NUMBER, INTERVAL_SECONDS) |
94 | 94 |
|
95 |
| - # CUSTOM METHOD EXAMPLE |
96 |
| - # def custom_print(params): |
97 |
| - # print("Custom method called") |
98 |
| - # return [255, 20] |
99 |
| - # pybytes.add_custom_method(0, custom_print) |
| 95 | + # CUSTOM METHOD EXAMPLE |
| 96 | + # def custom_print(params): |
| 97 | + # print("Custom method called") |
| 98 | + # return [255, 20] |
| 99 | + # pybytes.add_custom_method(0, custom_print) |
0 commit comments