Jump to content

Recommended Posts

Posted (edited)
1 hour ago, Bliss said:

So reload you page to get the latest version...  (It might update to latest version by itself...)

I did Ctrl+Shift+R to refresh... And fooey, I should have listened to that little voice and saved first :sad:

Anyhow, I had my screenshot to quickly fall back on what changes I had made... Only this time I didn't bother commenting and "cleaning" up unused code... I just broke the connection where I wanted to to end... Which apparently DOES NOT actually break the flow???  :oh:    Wow... Note to self... Leaving "scraps" of blocks around might affect how the code runs.

Anyhow, YES! that adjustment to the input value worked!... And apparently so does the rest of your code :pir-love:... Albeit the count times are dramatically shorter than they should be.  Oh, goody... There is still something to figure out :pir_tong2:

 

Doubling the count brought it to the expected LL results.  Granted, those old friction gears I need to use in the arms are so inaccurate that precision positioning is not possible.

So, I am guessing you setup is counting either ON or OFF states, not the transition between states?

Edited by Gunners TekZone
Posted

This is a video of Blockly via Arduino Nano, to LEGO DACTA Interface-A, to a little robot arm simulating a welding machine (Unfortunately the old white friction gears in the arm often damp down what was to be more dramatic movements).  NOTE:  This link will not stay valid forever :wink:

https://www.dropbox.com/scl/fi/szpsacoz89awqiy3bo5v6/20260408_190056.mp4?rlkey=18l0c233zk9lkzyn54z2wcnh9&dl=1
 

Posted (edited)

@Gunners TekZone

Thanks again, I took good note of you misfortune and will check if I could give a warning and confirm popup before it reload the page to prevent losing precious code.

for the count time you can change the On value change block that will count 0->1 and 1->0 by on one shot raising block which will only count on 0->1.

9 minutes ago, Gunners TekZone said:

This is a video of Blockly via Arduino Nano, to LEGO DACTA Interface-A, to a little robot arm simulating a welding machine (Unfortunately the old white friction gears in the arm often damp down what was to be more dramatic movements).  NOTE:  This link will not stay valid forever :wink:

https://www.dropbox.com/scl/fi/szpsacoz89awqiy3bo5v6/20260408_190056.mp4?rlkey=18l0c233zk9lkzyn54z2wcnh9&dl=1
 

Oh my god, thank you so much for making this video!

I needed this!  Great demo too!

Is it me or you used 9V motors? how it that possible?  Not the same connectors and must run slower?

Edited by Bliss
Posted (edited)
22 minutes ago, Bliss said:

for the count time you can change the On value change block that will count 0->1 and 1->0 by on one shot raising block which will only count on 0->1.

Um... What? :innocent2:

Can't there be a simple LOOP While COUNT INP (6) < (10) and/or LOOP Until COUNT INP (6) (=>) (10) block? (Stuff in brackets can be adjusted) That starts from 0 and internally counts up (via input state change)?

Edited by Gunners TekZone
Posted
21 minutes ago, Gunners TekZone said:

Um... What? :innocent2:

Can't there be a simple LOOP While COUNT INP (6) < (10) block? (Stuff in brackets can be adjusted) That starts from 0 and internally counts up (via input state change)?

I'll see what I can do for a counter block to be the most intuitive and simple as possible.

Again congrats and Thank you 1000X...  (And thanks for not giving up ;-) )

Posted (edited)
48 minutes ago, Bliss said:

Is it me or you used 9V motors? how it that possible?  Not the same connectors and must run slower?

Ha... Same question @evank asked when he saw a pic... Yes, the Interface-A only puts out 4.5v so the 9v motors run a bit slower.  But as they are internally geared, they still run with more torque (and plenty fast enough) than the 4.5v motors with a bunch of LEGO gearing added.

Oh, and as the wires for the 9v cables tend to rot, I learned how to make my own cables.

I originally tried this, but was crazy slow, and still too weak.

2024-12-04-22.15.38.jpg?rlkey=x3f8dj8148

Edited by Gunners TekZone
Posted (edited)

@Gunners TekZone,

So here is the deal for the lost of your project when reloading the page.

It is unfortunately not possible to prevent the browser to reload with CTRL-SHIFT-R ou SHIFT-R, but for F5, or CTRL-R, etc, we can ask for a confirmation (But only if you have unsaved changes).

So in the new version, I implemented that and I would advise you to keep from using the CTRL-SHIFT-R since my auto update mecanism since to work pretty well.  (I must admit that I use myself CTRL-SHIFT-R haha but I'm a save button freak ;-) )

Also new in the version, rather than have a connect button for each device, it is now a dropdown selector and one Connect button.  It is cleaner and can easily expand for futur device :-)

 

EDIT: It appears after testing that CTRL-SHIFT-R is also displaying the confirmation popup if you have unsaved project...

 

Edited by Bliss
Posted (edited)
[CM null] Requesting serial port...
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001124-0000-1000-8000-00805f9b34fb, name='88:4D:7C:E9:50:F4'
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001200-0000-1000-8000-00805f9b34fb, name='88:4D:7C:E9:50:F4'
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001124-0000-1000-8000-00805f9b34fb, name='C0:44:42:C7:F1:B9'
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001200-0000-1000-8000-00805f9b34fb, name='C0:44:42:C7:F1:B9'
DeviceLegoRcx.js:215 Signature: ff 5a a5
DeviceLegoRcx.js:158 Sent: fe 00 00 ff a5 5a 44 bb 6f 90 20 df 79 86 6f 90 75 8a 20 df 62 9d 79 86 74 8b 65 9a 2c d3 20 df 77 88 68 97 65 9a 6e 91 20 df 49 b6 20 df 6b 94 6e 91 6f 90 63 9c 6b 94 3f c0 85 7a
DeviceLegoRcx.js:275 collected: 00 ff 5a a5 4a
DeviceLegoRcx.js:63 [CM CM1] Connected.

We have a stable connection

CM null] Requesting serial port...
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001124-0000-1000-8000-00805f9b34fb, name='88:4D:7C:E9:50:F4'
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001200-0000-1000-8000-00805f9b34fb, name='88:4D:7C:E9:50:F4'
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001124-0000-1000-8000-00805f9b34fb, name='C0:44:42:C7:F1:B9'
index.html:1 Chooser dialog is not displaying a port blocked by the Serial blocklist: bluetoothServiceClassId=00001200-0000-1000-8000-00805f9b34fb, name='C0:44:42:C7:F1:B9'
DeviceLegoRcx.js:215 Signature: ff 5a a5
DeviceLegoRcx.js:158 Sent: fe 00 00 ff a5 5a 44 bb 6f 90 20 df 79 86 6f 90 75 8a 20 df 62 9d 79 86 74 8b 65 9a 2c d3 20 df 77 88 68 97 65 9a 6e 91 20 df 49 b6 20 df 6b 94 6e 91 6f 90 63 9c 6b 94 3f c0 85 7a
DeviceLegoRcx.js:275 collected: 00 ff 5a a5 4a
DeviceLegoRcx.js:63 [CM CM1] Connected.
main.js:529 Generated code:
 {
  shouldStop();
  const dev = deviceManager.getDeviceByName("CM1");
  if (!dev) throw new Error("Device lost");
  await dev.snd(1);
}

DeviceLegoRcx.js:215 Signature: ff ae 51
DeviceLegoRcx.js:158 Sent: fe 00 00 ff 51 ae 01 fe 52 ad
DeviceLegoRcx.js:275 collected: e8 17 ff ae 51
main.js:529 Generated code:
 {
  shouldStop();
  const dev = deviceManager.getDeviceByName("CM1");
  if (!dev) throw new Error("Device lost");
  await dev.snd(2);
}

DeviceLegoRcx.js:215 Signature: ff a6 59
DeviceLegoRcx.js:158 Sent: fe 00 00 ff 59 a6 02 fd 5b a4
DeviceLegoRcx.js:275 collected: ae 51 ff a6 59

We have sound playback on the cyber master, Nice work!

Edited by AJB2K3
Posted (edited)
[CM null] Requesting serial port...
DeviceLegoRcx.js:215 Signature: ff 5a a5
DeviceLegoRcx.js:158 Sent: fe 00 00 ff a5 5a 44 bb 6f 90 20 df 79 86 6f 90 75 8a 20 df 62 9d 79 86 74 8b 65 9a 2c d3 20 df 77 88 68 97 65 9a 6e 91 20 df 49 b6 20 df 6b 94 6e 91 6f 90 63 9c 6b 94 3f c0 85 7a
DeviceLegoRcx.js:275 collected: f8 ff 5a a5 4a b5 75 8a 73 8c 74 8b 20 df 61 9e 20 df 62 9d 69 96 74 8b 20 df 6f 90 66 99 66 99 20
DeviceLegoRcx.js:63 [CM CM1] Connected.

Yes it does ! The motors are running great. I'll test the sensors after work :-)

Oh... there is no block to take the actual value of the sensor.

Edited by Wapata
Posted (edited)
11 hours ago, Wapata said:

Oh... there is no block to take the actual value of the sensor.

There are blocks for sensors but I did not implement yet the motor's tacho that exist only in the CM...  I have to find more info about the particularities of CM...

This post show an example how to set a sensor type for an input and then monitor it:

 

Edited by Bliss
Posted

I'm not good :imperialguard_commander1:

55197380818_e3e22f1a17_b.jpg

 

Alone, the bottom left block is working. But with any of the other blocks it does not. I've added loop too and nothing again. I have to find the logic, but i do not have it yet. :wall:

Posted (edited)

@Wapata,

Indeed, you must use a main group of blocks or main loop if you want to have a program that runs non stop.

Then you can create tasks or task loops and call then in the main loop...

You have choice of Function block or task blocks.  Task block will execute in parallel and independantly, like multi tasking.

Function is just an extension of your main program...

So it really depends if you want to do "inline" programming, so executing one block after the other using blocking instructions like wait blocks...

Or Fast loop programming with independant task and a fast scan rate...

From your example, this looks like inline programming.  Besides your Loop program, the other goup of blocks if they would be executing (par of a function) would execute one block at a time, only once.

Here is an example of what I think you want to achive.
I left the Loop while true but it is not mandatory to have it.
Once you call the task loops (start task block), the task will run forever until you press stop.  Even if it says Program finished in the status log... 

Don't expect a fast response time, RCX can't really be used as I/O port extender lol using slow 2400 baud communication.
The best use is to have a Lego Interface A or B and want to interact with a program running inside RCX or CM using the MSG instruction block...

800x358.png

The problem is to monitor continuously RCX/CM inputs value, We have to send the request to get the value and wait for the reply, on a half duplex 2400 baud serial link.  And there is also the IR link to the brick...
So PC -> serial 2400 baud -> IR Tower-> IR Link -> PBrick -> IR Link -> IR Tower -> Serial 2400 baud -> PC...  Not the best...
BUT the outputs are responsive though.  If I do the same logic of the example above, but using Touch sensor from Interface B rather than  RCX touch sensor, then you would see that the rcx motors respond to Int.B touch sensor almost instantaneously.

 

Edited by Bliss
Posted

Ooookay :pir-oh3: I think it make sense. I will test that tomorrow morning then.

Thank you for the answer and about the 2400 bauds.... It is still a lot of information in one second for a human perspective.

But yeah, having external sensors playing with portative device is a goal. Having a simpler task that we can share as an example to check if everything work as expected is... More urgent :innocent:

And playing with program running inside the RCX or CM is not for tomorrow for me... I still have a learning curve to follow. But boy... Right now, linking all theses Lego devices is super cool.

In the end of the day, I predict you will have blockly compatible with an Arduino device with a hat that simulate the in/out of an interface-B... It's a simple matter of cutting Lego electric cables in half and a dozen of electronic components :pir-grin:

Posted (edited)

Here is a new block you may like as an alternative to the print block. 

A Display block that displays the value (Bool, Numbers, Text) you connect to it (might be a math expression too).

It displays the value only when executed or else, it displays the last value.

If you want to display values in real time, you can put the display blocks in their own task loop...

chrome_nHxNBueztv.png

Edited by Bliss
Posted (edited)
2 hours ago, Bliss said:

BUT the outputs are responsive though.  If I do the same logic of the example above, but using Touch sensor from Interface B rather than  RCX touch sensor, then you would see that the rcx motors respond to Int.B touch sensor almost instantaneously.

Well, that is the thing though, isn't it? RCX' CM's, Spybots, NXT's, EV3's don't need the brain of a computer program, they are hooked up to. They are supposed to do it on their own. They may - if at all - submit the result of their decision. That's their reason of existence.

Why using a 2400 Baud line simply to polling them, if they can do so much faster on their own? I simply don't get that approach.

In contrast, Int A/B are dumb, they rely on computer control.

Best
Thorsten

Edited by Toastie
Posted
16 minutes ago, Toastie said:

Why using a 2400 Baud line simply to polling them, if they can do so much faster on their own? I simply don't get that approach.

Well, I think NQC is great but it makes another language to learn that is "not quite" intuitive for the common mortal...

I understand the interest of having a common programming language for all devices and moreover, an intuitive and easy to learn one.

So yes, if your looking for more I/O in you project , being able to use RCX as an I/O expander would be great...

@Wapata, as an alternative to Bricxcc/nqc, you should try the BlockNQC from @maehwhttps://www.webpbrick.com/nqc/blocknqc/

I'm not sure the compiler/uploader works with CyberMaster though...  But the BlockNQC will generate the NQC Code.
I don't know if it supports the special instrucrion for the cybermaster like the tachometer for Output A et B...

I think the interest for blockly is the look (Interlocking block like legos :-) ) and its somewhat intuitive aspect.
But as pointed out by many here, there is still a learning curve but maybe not as important as C#, C++, Python etc...

 

The Lego Blockly web app is interesting because you can start with inline blocking programming like Logo.
The "Lego Lines" program of @Gunners TekZone that we translated to blockly is a good and quite complex example of inline programming.

And when we're ready, we can upgrade and go for Non-blocking programming approach with Multi-tasking, non blocking timers, avoiding WAIT blocks etc... 

Posted
6 hours ago, Toastie said:

Why using a 2400 Baud line simply to polling them, if they can do so much faster on their own? I simply don't get that approach.

Best
Thorsten

It is because the whole time of the VLL/IR and Radio is based on the 2400 baud rate. Any faster and the pulses loose timing and the definite cant understand the signals.

Its the same as if someone is talking to you way to fast and you cant understand what they are saying.

Posted
7 hours ago, Toastie said:

I simply don't get that approach

Interactions. You can have a mobile sensor on CyberMaster that give an order to on fixed motor on Interface-B and vice versa. This alone is (i think) a great justification.

Plus everything above. But in the end CyberMaster can have a built in program PLUS radio interactions with Blockly as with the official game that count (on the computer) the number of times we touch the moving robot.

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...