Awesome stuff Jim! This is the first 'logic' block I've seen anywhere on any NXT site.Some questions:How deep can you stack 'switch' commands? (RCX had a pretty strict limit if I recall correctly.)Can you switch off of an internal variable? (I only see sensors and messages in the dropdown list, but that may be because you have no internal variables declared.)If you cannot use 'switch' on a variable, is there another way to branch based on internal variable state?
I managed to stack SWITCH blocks 4 deep before the desktop became just too much of a hassle to move around... but I do think there will be a memory limit, although I don't know what that will be.Go to the link below to see an image of embedded SWITCH blocks.http://www.bluerocketwriting.com/embedded.JPGIn this image, you can't see the original SWITCH block, but what you are looking at (left to right) is a touch sensor SWITCH, leading to a BRICK BUTTON SWITCH, leading to a ROTATION SENSOR SWITCH. I didn't put conditions in all of them, but I wanted you to see sort of how it flows.As for your other questions... I don't see a way to turn off an internal variable, but maybe someone else can confirm or debunk this... I can understand why you'd want that feature.I haven't gotten into the 'wires' of the blocks... mainly because I'm just not that knowledgeable yet... take a look at this figure for an example of what I'm talking about:http://www.bluerocketwriting.com/wiring.JPG
Thank you.This is the best type of info.It give us a "almost have it" feeling. Would be great with a small video of the Rob's behavior.
I'll try and post some more blocks over the next few days. I don't have a video camera, but another reader has put me onto a 'screen recorder' - to be honest, I just haven't had much time to test it, but I do intend to do so... maybe this weekend. My real job is getting in the way of my hobby ;)
Hallo againTake your time. Here in Europe we have to wait until September anyway!!!
Variables were left out of the 1.0 and 1.5 firmwares for the RCX and did not make an appearance until 2.0 when they finally were avaialable and could be used in things like 'switch' statements or as parameters for motor speeds values for tones.If you can find variable support in the software I'll be very happy (maybe even make a post about it, showing how they work and where they can be used?)It would feel like a step backwards if there are no user defined variables available to the NXT.
> Can you switch off of an internal variable? Notice the Control: field in the configuration panel (Jim's third picture, next to the eye icon). This can be set to "sensor" (as in Jim's example), or "variable". If "variable" is selected, the Type: field changes from a list of sensors to a list of three variable types (logic, number, and text). You can switch on any of these options. With numbers or text, the switch block can have multiple options (including a default, just like a "real" switch statement in a text language). As to "nesting", I just nested 8 of them (and a ninth level, a loop, inside that)... and I stopped because I was tired, not due to a limit or crash. Incidently, the Loop block also has a Control: field, which can be set to Forever, Sensor, Time, Count, and Logic... there is a LOT of flexibility built in!-- Brian Davis
I'm sorry, I didn't mean to imply variables weren't supported... they are... good news.Using the wiring of the blocks, I think it will be possible to 'turn off' a variable - I know you can reset them, increment, and other mathematical functions using some DATA bricks, but I'll have to play with them a little to get you an answer.But yes, variables do exist.Jim
Jim and Brian:Thanks -- Brian nailed my question by stating that the sensor list is different than the variable list.So, what I'd really love to see is the power behind the variables. ;)As to the specific phrase 'Can you switch off of an internal variable?' I meant 'use a SWITCH BLOCK with an internal variable', not 'switch off' (which I think Jim later interpreted as 'turn off').In other words, my question has been answered and my fears of RCX 1.0 all over again have been put to rest! I'm looking forward to an expose on the types of variables supported (do we get arrays?) and thank you both once again for your continued effort at providing glimpses into the power behind the NXT.
I have NOT seen any instances of arrays... Brian?Jim
Arrays were a tough call, and they did not make it into the current SW, but... that doesn't mean LEGO doesn't know about them, or that there are not work arounds. I'll try to get stuff out on this, but I've already got ways of doing simple 1-D arrays.-- Brian Davis
Post a Comment