Skip to content

Commit 9829779

Browse files
committed
updated getting started pages
1 parent fde114e commit 9829779

File tree

2 files changed

+18
-58
lines changed

2 files changed

+18
-58
lines changed

content/pybytes/dashboard.md

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,20 @@ In this section, we will explain how to create widgets for data visualisation an
1616

1717
```python
1818
# Import what is necessary to create a thread
19-
import _thread
20-
from time import sleep
21-
22-
# Increment index used to scan each point from vector sensors_data
23-
def inc(index, vector):
24-
if index < len(vector)-1:
25-
return index+1
26-
else:
27-
return 0
28-
29-
# Define your thread's behaviour, here it's a loop sending sensors data every 5 seconds
30-
def send_env_data():
31-
idx = 0
32-
sensors_data = [0, -0.2, -0.5, -0.7, -0.8, -0.9, -0.9, -0.9, -0.8, -0.6, -0.4, -0.2, 0, 0.3, 0.5, 0.7, 0.8, 0.9, 0.9, 0.9, 0.8, 0.6, 0.4, 0.1]
33-
34-
while True:
35-
# send one element from array `sensors_data` as signal 1
36-
pybytes.send_signal(1, sensors_data[idx])
37-
print('sent {} to Pybytes'.format(sensors_data[idx]))
38-
idx = inc(idx, sensors_data)
39-
sleep(5)
40-
41-
# Start your thread
42-
_thread.start_new_thread(send_env_data, ())
19+
import time
20+
import math
21+
22+
# Send data continuously to Pybytes
23+
while True:
24+
for i in range(0,10):
25+
26+
pybytes.send_signal(math.sin(i*math.pi))
27+
print('sent signal {}'.format(i))
28+
time.sleep(10)
4329
```
4430

4531
2. Press *Upload* button to upload the code into your device.
4632

47-
3. After the upload is done, the device will reboot and start sending data to Pybytes. In the Pymakr terminal, you should see messages send to Pybytes.
48-
![](/gitbook/assets/pybytes/dashboard/device-send-messages.png)
4933

5034
## Step 2: Add a signal from your device
5135

content/pybytes/gettingstarted.md

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -49,48 +49,24 @@ After creation, you will land on the provisioning page. This is where we 'inform
4949
## Step 4: Your first signal
5050

5151
1. Reset your Pycom device using the reset button. This will reboot the device and activate the Pybytes connection automatically. The output will look similar to this. You should see the `Last Connection` status in Pybytes change from `Never` to `Seconds ago`
52-
```
53-
>>> ets Jun 8 2016 00:22:57
54-
55-
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
56-
configsip: 0, SPIWP:0xee
57-
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
58-
mode:DIO, clock div:1
59-
load:0x3fff8020,len:8
60-
load:0x3fff8028,len:2140
61-
ho 0 tail 12 room 4
62-
load:0x4009fa00,len:19760
63-
entry 0x400a05bc
64-
WMAC: {redacted}
65-
Firmware: {latest version}
66-
Pybytes: {latest version}
67-
Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
68-
WiFi connection established
69-
Connected to MQTT mqtt.pybytes.pycom.io
70-
Pybytes connected successfully (using the built-in pybytes library)
71-
Pybytes configuration read from /flash/pybytes_config.json
72-
73-
```
7452

7553
> If you get any kind of error message, check the WiFi credentials you entered are correct and that you are in range of this WiFi network
7654
77-
2. Use the opportunity to define a signal in Pybytes. The signal number can be anywhere from 0-254 (255 is reserved)
78-
79-
![](/gitbook/assets/pybytes/add-device/define-signal.png)
80-
81-
3. Now, in the REPL, you can type:
55+
2. Now, in the REPL, you can type:
8256
```python
8357
>>> pybytes.send_signal(1, "hello world")
8458
```
8559
And it will show up on Pybytes in the `signals` tab:
8660

8761
![](/gitbook/assets/pybytes/add-device/send-signal.png)
8862

89-
> Next to `pybytes.send_signal(...)`, we can use ...
90-
91-
63+
You can continue to [display data from your device into the Pybytes dashboard](/pybytes/dashboard/)
9264

9365
## Final remarks
94-
If you wish to disable Pybytes, you can use `pycom.pybytes_on_boot(False)` will permanently
66+
If you wish to disable Pybytes, you can use `pycom.pybytes_on_boot(False)` will permanently. It is also possible to start Pybytes in a later stage (not on boot) by importing the module:
67+
```python
68+
from _pybytes import Pybytes
69+
pybytes = Pybytes
70+
```
71+
9572

96-
Continue to [display data from your device into the Pybytes dashboard](/pybytes/dashboard/)

0 commit comments

Comments
 (0)