Jump to content

Recommended Posts

Posted (edited)

i got my self a rcx brick 1.0 yellow one and i wondered is there a way to change the action of the output of a touch sensor,at the momant i got a siren to the sensor then to the rcx when i run it the siren works pressing the sensor stops it.is there a way of the siren starts by pressing the sensor :shark::cannon::kahuka:

Edited by Alasdair Ryan
Posted

Well obviously it would be possible to create a little program for the Mindstorms RCX that will make it possible to create a toggle function for a touch sensor. Unfortunately I don't have the software for the RCX at hand so I can't create an example for that, but you would be able to do it with the following psuedo-code:

start loop
set output on
wait for sensor pressed
set output off
wait for sensor pressed
end loop

With above you would have a situation where the siren starts off making sound, then when you press the touch sensor it switches of and when you press the touch sensor again it would turn back on and the cycle is restarted again, where you can press it again to turn it off again.

If you would use NQC (using Brixcc) to program it you could use the following code:

task main() {
int sirenOn = 1;
SetSensor(SENSOR_1, SENSOR_TOUCH);
OnFwd(OUT_A);

while(true) {
    if (SENSOR_1 == 1 && sirenOn == 1) {
	    sirenOn = 0;
		Off(OUT_A);
	} else {
		sirenOn = 1;
		OnFwd(OUT_A);
	}
}
}

I hope that I understood your question correctly.

Posted (edited)

You can download the Lego RCX 1.0 software from the Lego RCX Command Center. Note that The Lego Group (TLG) does not support the Lego RCX anymore, but there are websites that still deal with that platform. After you download the software, you can look at the "Beginning to Use the Lego Touch Sensor" example on the website http://www.kipr.org/curriculum/touch.html#anchor701290 . They have some example programming code that you could adapt to your situation. :classic:

Alternatively, you could buy one of the old Lego Mindstorms CD disk ( http://www.bricklink.com/catalogPG.asp?G=4493852 ) and not worry about downloading the software. The CD contains some basic instructions that may be helpful in setting up the programmable brick.

P.S. If you don't have the 9713 RCX Infrared Transmission "Tower" that accompanies the RCX kit, you won't get very far. It is needed to transfer the computer programming to the RCX brick, via an infrared signal. A picture of it appears below.

9713-1.jpg

Edited by DLuders

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...