updated getting started pages

This commit is contained in:
gijsio
2020-10-02 12:33:12 +02:00
parent fde114ea02
commit 9829779594
2 changed files with 16 additions and 56 deletions

View File

@@ -16,36 +16,20 @@ In this section, we will explain how to create widgets for data visualisation an
```python
# Import what is necessary to create a thread
import _thread
from time import sleep
import time
import math
# Increment index used to scan each point from vector sensors_data
def inc(index, vector):
if index < len(vector)-1:
return index+1
else:
return 0
# Send data continuously to Pybytes
while True:
for i in range(0,10):
# Define your thread's behaviour, here it's a loop sending sensors data every 5 seconds
def send_env_data():
idx = 0
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]
while True:
# send one element from array `sensors_data` as signal 1
pybytes.send_signal(1, sensors_data[idx])
print('sent {} to Pybytes'.format(sensors_data[idx]))
idx = inc(idx, sensors_data)
sleep(5)
# Start your thread
_thread.start_new_thread(send_env_data, ())
pybytes.send_signal(math.sin(i*math.pi))
print('sent signal {}'.format(i))
time.sleep(10)
```
2. Press *Upload* button to upload the code into your device.
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.
![](/gitbook/assets/pybytes/dashboard/device-send-messages.png)
## Step 2: Add a signal from your device