Statements about LEGO lamp brick for NXC
Statements about LEGO lamp brick for NXC
Help!
What are the NXC statements for the LEGO lamp brick? How to control the functions such as on, off or blinking?
I cannot find these statements in the NXC Programmer's Guide.
YH Chan
What are the NXC statements for the LEGO lamp brick? How to control the functions such as on, off or blinking?
I cannot find these statements in the NXC Programmer's Guide.
YH Chan
Last edited by chanyh on 08 May 2011, 08:00, edited 1 time in total.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Statements about LEGO Light Brick for NXC
Light brick? Do you mean the light sensor light? Use these lines to turn the light on and off:
If you are referring to the actual 9v light, you use it on the motor port, so the controls are exactly the same as the motors (OnFwd, and Off).
Code: Select all
SetSensorType(S1, SENSOR_TYPE_LIGHT_ACTIVE); //Turn on the light
SetSensorType(S1, SENSOR_TYPE_LIGHT_INACTIVE);//Turn off the light
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Statements about LEGO Light Brick for NXC
Matt,
Sorry!
I mean the LEGO lamp brick, not the NXT Light Sensor or old RCX Light Sensor.
I try to use the following program, but no affect.
YH Chan
Sorry!
I mean the LEGO lamp brick, not the NXT Light Sensor or old RCX Light Sensor.
I try to use the following program, but no affect.
Code: Select all
task main()
{
while(true)
{
SetSensorType(OUT_A, SENSOR_TYPE_LIGHT_ACTIVE); //Turn on the light
Wait(1000);
SetSensorType(OUT_A, SENSOR_TYPE_LIGHT_INACTIVE);//Turn off the light
Wait(500);
}
}
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Statements about LEGO Light Brick for NXC
Can you give a BL URL to it? I have no idea what lamp brick you are talking about...chanyh wrote:...I mean the LEGO lamp brick...
YH Chan
Do you mean the new PF LEDs? You use those with the motor port, so you would turn them on and off like a motor.
I don't remember any lamp brick, other than the RCX one. Maybe there were some from the 12v train days, or the 4.5v sets...
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Statements about LEGO lamp brick for NXC
The lamp brick is the Electric, Light Brick 1 x 2 with Single Top Light.
The URL link is : http://www.bricklink.com/catalogItem.asp?P=4767
YH Chan
The URL link is : http://www.bricklink.com/catalogItem.asp?P=4767
YH Chan
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Statements about LEGO lamp brick for NXC
Okay, that is a 9v lamp, same as the RCX one, only this one you can reverse the polarity to make it flash (not really a necessary feature when being controlled by the NXT ).
To use it, use an NXT -> RCX converter wire in a motor port. Use the motor commands to turn it on and off.
To use it, use an NXT -> RCX converter wire in a motor port. Use the motor commands to turn it on and off.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Statements about LEGO lamp brick for NXC
From the the LEGO Mindstorms website, one can download a Lamp* block in the package of Legacy_Blocks. This block can control a lamp.
I want to control the lamp by NXC statements.
YH Chan.
I want to control the lamp by NXC statements.
YH Chan.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Statements about LEGO lamp brick for NXC
So use the OnFwd/OnRev and the Off/Coast commands.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: Statements about LEGO lamp brick for NXC
Hi, Matt,
Thanks!
I use the commands that you suggested. It works.
YH Chan.
Thanks!
I use the commands that you suggested. It works.
YH Chan.
Who is online
Users browsing this forum: No registered users and 4 guests