Skip to content

Ungravitation/blockly-android-master

 
 

Repository files navigation

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.

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和蓝牙通信的机器人编程APP

主要功能:

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

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

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

4、新增小车文章智能小车实践

截图

实现原理

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中也有,具体可参看源码

Releases

No releases published

Packages

No packages published

Languages

  • Java 94.4%
  • JavaScript 5.3%
  • Other 0.3%