btrespond.java
来自「专业汽车级嵌入式操作系统OSEK的源代码」· Java 代码 · 共 45 行
JAVA
45 行
import lejos.nxt.*;import lejos.nxt.comm.*;public class BTRespond { public static void main(String [] args) throws Exception { byte[] inMsg = new byte[32]; byte [] outMsg = new byte[32]; boolean cmdMode = true; BTConnection btc = null; int len; String connected = "Connected"; while (true) { if (cmdMode) { btc = Bluetooth.waitForConnection(); LCD.clear(); LCD.drawString(connected,0,0); LCD.refresh(); cmdMode = false; } len = Bluetooth.readPacket(inMsg,32); if (len > 0) { LCD.drawInt(inMsg[1] & 0xFF,3,0,1); LCD.refresh(); LCP.emulateCommand(inMsg,len); if (inMsg[1] == 0x09) { LCD.drawString("Message",0,2); LCD.refresh(); btc.close(); Thread.sleep(100); cmdMode = true; } } } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?