后來,一個團隊開發(fā)了一個名為S4A(Scartch for Arduino)的軟件:http://s4a.cat/ 將Scartch與Arduino連接起來。結(jié)合了Scartch的編程優(yōu)點,外加Arduino的眾多傳感器,一時間孩子們也能夠玩轉(zhuǎn)舵機,開關(guān),以及模擬量的傳感器了。S4A使用了Arduino的6路AD采集接口,3路PWM接口和3路舵機接口,方便小孩子連接傳感器,實現(xiàn)自己的設(shè)計。
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
軟件包已經(jīng)上傳,名為S4Nu.rar(Scartch for Nucleo)歡迎大家提前下載使用。另外需要特別注意的是:雖然Nucleo自帶了串口,但是在與S4A連接的時候不要使用這個串口。也不要使用USB連線將Nucleo與電腦相連。
應(yīng)該對Nucleo使用外部供電。并使用USB轉(zhuǎn)串口工具,例如CP2102,F(xiàn)T232等連接電腦與Nucleo的串口。具體是什么原因暫時還未知。可能在接下來的幾天內(nèi)能夠解決這個問題,也可能解決不掉。下面就要說說如何設(shè)置Nucleo的硬件部分:
S4A的Arduino源代碼中定義了一個14個元素的數(shù)組,用來表示D0~D13的引腳的信息和狀態(tài):
pin arduinoPins[14]; //Array of struct holding 0-13 pins information
S4A對每一個引腳的功能都加以區(qū)分:
[原文]
Components have to be connected in a particular way. S4A allows for 6 analog inputs (analog pins), 2 digital inputs (digital pins 2 and 3), 3 analog outputs (digital pins 5, 6 and 9), 3 digital outputs (pins 10, 11 and 13) and 4 special outputs to connect Parallax continuous rotation servomotors (digital pins 4, 7, 8 and 12).
[原文]Protocol
S4A interacts with Arduino by sending the actuator states and receiving sensor states every 75 ms, therefore the pulse width needs to be greater than this time period. The data exchange follows the PicoBoard protocol and needs a specific program (firmware) to be installed in the board. Please refer to the Downloads section for further instructions on how to do so.