我是树莓派的初学者,我有一个基本的怀疑。在
我基本上是想把我的树莓皮做成一个信标,然后把它的数据发布到一个Android应用程序上。在
我想知道我是否可以在一个文件中给出多个终端命令,并通过编译和运行该文件来运行所有命令?在
我跟着this tutorial。在
我最基本的怀疑是,每次我要检查一个设备是否可用(蓝牙)并为其做广告时,它都需要一个命令。我可以将多个raspberry pi命令集成到一个文件中,并通过编译和运行该文件(作为脚本)来运行所有这些命令吗?在
以下命令很少:
sudo hcitool lescan,
sudo hcitool hci0,
sudo hcitool -i hci0 0x008,
很少有像这样的命令。。在
假设您有一个文件
example.txt
,其中包含以下命令:然后可以通过运行
sh example.txt
或bash example.txt
来执行这些命令。 见ubuntu run text file as command如果您真的想使用python实现这一点,可以使用subprocess模块。在
如果你想要一个循环:
^{pr2}$在/home/pi中/蓝牙命令.txt文件:
^{3}$相关问题 更多 >
编程相关推荐