找回密码
 马上注册

QQ登录

只需一步,快速开始

查看: 5453|回复: 3

新的光线传感器的官方回复

[复制链接]
发表于 2009-8-18 22:28:39 | 显示全部楼层 |阅读模式
Make sure that you have the latest test release of BricxCC/NBC/NXC which you can download from http://bricxcc.sourceforge.net/test_release.zip.  Extract the zip over your existing BricxCC installation with directory structure maintained as in the zip.  Then make sure you tell BricxCC to target an NXT 2.0 compatible firmware on the Compiler|NBC/NXC preferences tab.  If you use the command line compiler directly then pass -v=128 on the command line.  Also make sure you have either the enhanced NBC/NXC firmware version 1.28 or the standard NXT firmware version 1.28 installed on your NXT.  The enhanced NBC/NXC firmware will be updated to version 1.28 in the latest test release later on today.  Right now the enhanced firmware is at version 1.27, which does include color sensor support but not via the built-in menu system.

Support for the new color sensor is built into the header files that are automatically included by the compiler (NBCCommon.h and NXCDefs.h).  To configure the sensor use one of these functions:

SetSensorColorFull(byte port);
SetSensorColorRed(byte port);
SetSensorColorGreen(byte port);
SetSensorColorBlue(byte port);
SetSensorColorNone(byte port);

Use the first if you want to use the sensor as a full color sensor.  Use the Red, Green, and Blue functions to turn the sensor on as a color lamp with either red, green, or blue light.  The last one turns off the lamp.

To read the sensor color number just use SENSOR_1, SENSOR_2, SENSOR_3, or SENSOR_4 (depending on which port your sensor is connected to).  To read additional values from the color sensor's IOMap structure you can a number of other API functions.  I posted a list on the nxtasy forums.

http://forums.nxtasy.org/index.php?s=&showtopic=4080&view=findpost&p=31616

Hope this helps,

John Hansen

评分

参与人数 1激情 +5 宣传 +2 收起 理由
糖伯虎 + 5 + 2

查看全部评分

如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
发表于 2009-8-18 23:02:45 | 显示全部楼层
虽然我们自己已经解决,但是还是非常感谢你
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2009-8-19 15:25:32 | 显示全部楼层
看不懂,希望斑竹给翻译下哦
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2009-8-19 18:25:43 | 显示全部楼层
大概意思是:
确定你下的是最新的版本的测试包,然后把解压缩的文件覆盖原来安装的目录
把最新的*_tempxxxx文件的内容在bricxcc里面进行覆盖,
把编译器选择2.0
完成上面步骤就可以使用最新的颜色传感器了
如果还不明白的话,可以找下wangdi的帖子,我和他有在论坛讨论过。
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|中文乐高 ( 桂ICP备13001575号-7 )

GMT+8, 2024-3-28 23:18 , Processed in 0.074525 second(s), 20 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表