今日讀的進度,以及筆記 For python3的部分
安裝要有的原始碼
1.安裝pyserial
pip install pyserial
2.安裝Firmata
下載新版Arduino中就有了
3.安裝pyfirmata
pip install pyFirmata
4.下載測試程式 Firmata Test
http://www.firmata.org/wiki/Main_Page
5.啟動.exe
就有底下的畫面

利用python畫圖(利用亂數取產生點)
※需要安裝matplotlib (pip install matplotlib)
from matplotlib import pyplot
import random
x = range(0,25)
y = [random.randint(0,100) for r in range(0,25)]
fig1 = pyplot.figure()
pyplot.plot(x, y, '-') #繪畫的座標以及表現方法
pyplot.title('First Plot - Random integers')
pyplot.xlabel('X Axis') #兩軸標示
pyplot.ylabel('Y Axis')
pyplot.show()

接下來就可以導入CSV或者數學方程式畫出我們想要的圖形

以及將範例code的部分放到data裡面了
Comments
comments powered by Disqus