您当前的位置:首页 > 电子 > 无线/电,信号与通信

Android 基于Android blockly和蓝牙通信的机器人编程APP

时间:03-16来源:作者:点击数:
Blockly

Blockly is a library for building drag-and-drop visual editors for JavaScript and other programming languages. Blockly for Android is a developer preview of Blockly's editor built with standard Android views and fragments, offering more responsive touch performance and easier integration in Android apps.

Blockly Turtle demo running on an Android tablet.

Blockly Turtle demo running on an Android tablet.

Get started building your own Android app using Blockly.

Google is proud to offer Blockly for Android for free and open source under the Apache License, version 2.0.

Blockly has an active developer forum. Please drop by and say hello. Show us your prototypes early; collectively we have a lot of experience and can offer hints which will save you time.

Help us focus our development efforts by telling us what you are doing with Blockly. The questionnaire only takes a few minutes and will help us better support the Blockly community.

Want to contribute? Great! First, read our guidelines for contributors.

基于Android blockly和蓝牙通信的机器人编程

github源码

智能小车实践

主要功能:

1、在Android blockly的基础上改造,可以实现编程构建

2、蓝牙连接机器人(自主研发的),通过蓝牙与机器人交互

3、自定义blockly模块,UI自定义

截图

蓝牙连接

控制界面

循迹指令

实现原理

1、蓝牙连接,ble蓝牙连接及其通信,主要在bleutils包下面,其他界面相关实现在robot包下

2、Blockly 自定义模块,创建生成模块,构建完毕生成js和json,json为模块解析构建的样式和类型依据,

js为执行相关语句的构建,例如 if else的构建。

3、Blockly编程实现,生成js代码,然后放入webview中加载js,特定的蓝牙通信的指令代码实现其js和Android交互,Android进行蓝牙通讯。

4、js与Android通信为JavaBridge线程,可阻塞。(如果在需要同步阻塞等待设备传回消息,可以参考ShowInterface的sleep方法,循环等待)

5、对于ui的改造,在blocklylib-core中也有,具体可参看源码

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门