2013上海ORACLE研发者大会.pptVIP

  • 3
  • 0
  • 约9.92千字
  • 约 46页
  • 2017-06-11 发布于北京
  • 举报
* * * * 建立NXT的Java运行环境 NXT刷固件,将NXJ固件使用leJOS的Flash工具写入到NXT中 如果刷机失败,可以从LEGO官网中找到固件刷回,NXT不会变砖 环境变量 NXJ_HOME LEJOS_NXT_JAVA_HOME PATH=%NXJ%\bin;%PATH% 写入leJOS到LEGO NXT 选择IDE,连接你的NXT 安装新软件 lejos - /tools/eclipse/plugin/nxj/ 以Eclipse为例 第一个程序 与新建类的方式相同 屏幕输出的两种方式 LCD类 System.out.println Hello,World 编译和上传程序 运行-LeJOS NXT Program 插件完成Link、上传和运行的工作 Eclipse方式 编译和上传程序 nxjc.bat,使用javac编译源码,生成class文件 nxjc HelloWorld.java nxjlink.bat,生成LE格式的nxj文件 nxjlink –o HelloWorld.nxj HelloWorld nxjupload.bat,上传nxj文件到NXT,执行程序 (–r参数) nxjupload –r HelloWorld.nxj nxj.bat,集成link和上传功能 nxj –r –o HelloWorld.nxj HelloWorld 手工方式 按键 名称 说明 回车/开机 菜单选择 左 右 退出/关机 当位于顶层菜单时,关机 leJOS的按键 leJOS的菜单 控制轮式小车 To fill a shape with an image. Use existing picture box, DO NOT delete and create new picture box. Right click on the shape. At the bottom of the submenu select “Format Shape” Select “Fill” at the top of the “Format Shape” dialog box. Select “Picture or Texture fill” from the options. And select “File” under the “Insert from” option. Navigate to the file you want to use and select “Insert” On the “Format” tab, in the Size group, click on “Crop to Fill” in the Crop tool and drag the image bounding box to the desired size DELETE THIS INSTRUCTION NOTE WHEN NOT IN USE 控制伺服电机 Motor类是对NXT马达的抽象 马达需要连接A/D端口 A端口 B端口 C端口 Motor类 类 方法 说明 Motor.A forward() 向前转动 backward() 向后转动 stop() 快速停止 getTachoCount() 返回马达角度 setSpeed(int speed) 设置每秒的角度值 rorate(int angle) 旋转angle角度 rorateTo(int angle) 旋转到angle角度 rorate(int angle,boolean immediateReturn) 如果是true,则方法立即返回 rorateTo(int angle,boolean immediateReturn) 如果是true,则方法立即返回 …… 轮式小车 控制两轮驱动的小车高层类,每个轮子都有自己的马达 两个轮子的连接端口 轮子的直径 两个轮子间的距离 DifferentialPilot类 演示—两轮小车运行 To fill a shape with an image. Use existing picture box, DO NOT delete and create new picture box. Right click on the shape. At the bottom of the submenu select “Format Shape” Select “Fill” at the top of the “Format Shape” dialog box. Select “Picture or Texture fill” from the options. And select “File” under the “Insert from”

文档评论(0)

1亿VIP精品文档

相关文档