后来,一个团队开发了一个名为S4A(Scartch for Arduino)的软件:http://s4a.cat/ 将Scartch与Arduino连接起来。结合了Scartch的编程优点,外加Arduino的众多传感器,一时间孩子们也能够玩转舵机,开关,以及模拟量的传感器了。S4A使用了Arduino的6路AD采集接口,3路PWM接口和3路舵机接口,方便小孩子连接传感器,实现自己的设计。
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
软件包已经上传,名为S4Nu.rar(Scartch for Nucleo)欢迎大家提前下载使用。另外需要特别注意的是:虽然Nucleo自带了串口,但是在与S4A连接的时候不要使用这个串口。也不要使用USB连线将Nucleo与电脑相连。
应该对Nucleo使用外部供电。并使用USB转串口工具,例如CP2102,FT232等连接电脑与Nucleo的串口。具体是什么原因暂时还未知。可能在接下来的几天内能够解决这个问题,也可能解决不掉。下面就要说说如何设置Nucleo的硬件部分:
S4A的Arduino源代码中定义了一个14个元素的数组,用来表示D0~D13的引脚的信息和状态:
pin arduinoPins[14]; //Array of struct holding 0-13 pins information
S4A对每一个引脚的功能都加以区分:
[原文]
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.