%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import random
data = [random.randint(0, 100) for i in range(40)]
plt.plot(data)
df = pd.DataFrame({'A': [1.0, 1.2, 3.4, 4.1, 8.2],
'B': [0.8, 1.4, 3.2, 4.3, 7.9],
'C': [1.3, 1.4, 2.9, 3.8, 9.4]},
index = ['d1', 'd2', 'd3', 'd4', 'd5'])
print(df)
A B C d1 1.0 0.8 1.3 d2 1.2 1.4 1.4 d3 3.4 3.2 2.9 d4 4.1 4.3 3.8 d5 8.2 7.9 9.4
# blink.py
# FT232H board
from time import sleep
import board
import digitalio
led = digitalio.DigitalInOut(board.C0)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
sleep(0.2)
led.value = False
sleep(0.2)
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-3-416f1853e9e1> in <module> 12 sleep(0.2) 13 led.value = False ---> 14 sleep(0.2) KeyboardInterrupt:
# FT232H board
import time
import busio
import board
i2c = busio.I2C(board.SCL, board.SDA)
i2c.try_lock()
from tmp102_cpy import Tmp102
sensor = Tmp102(i2c, 0x48)
while True:
print('Temperature: {0:.1f}'.format(sensor.temperature))
time.sleep(2)
Temperature: 18.1 Temperature: 18.1 Temperature: 18.1 Temperature: 18.1 Temperature: 18.1
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-4-006531ec661e> in <module> 12 while True: 13 print('Temperature: {0:.1f}'.format(sensor.temperature)) ---> 14 time.sleep(2) KeyboardInterrupt: