Jump to content

Bliss

Eurobricks Citizen
  • Posts

    158
  • Joined

  • Last visited

1 Follower

About Bliss

Spam Prevention

  • What is favorite LEGO theme? (we need this info to prevent spam)
    Technic
  • Which LEGO set did you recently purchase or build?
    None for now

Profile Information

  • Gender
    Male
  • Location
    Canada

Extra

  • Country
    Canada

Recent Profile Visitors

1,211 profile views
  1. @Gunners TekZone, @Toastie, @Wapata and all the others, I added the "Save As" button. The "clear" button has been replaced by a "New" button. (New Project). Which will clear the area and put back the project name to default. The last Folder used should be retain in a same session only. If you close and open the lego blockly page, it will revert to default folder (Downloads) until you save as or load a project... The save button will always now overwrite the same project file name. I also added the "New Edits" detection since the last save and you will have an "unsaved changes exist" indicator (Black Dot) on the left of the file name. When Unsaved edits exist, you will be asked for confirmation when you click on Load or New button... Latest Version: 2026-03-30-1212
  2. This function you gave in example, does not make a lot of sense though. The input variable should be "Sensor", then when you call the function, you connect Sensor_3 to Sensor, and later in your code, you may call again you function but this time, Sensr_4 connects to Sensor... Inside your function, you whould then only use "Sensor" variable.If you want to explictely use Sensor_3 inside the function, there is no need to use input variable... just use Sensor_3 variable already available as a global anyway. For the USB Tower, since I don't own one yet, I did not check what work has been done already to get it working on modern OS... The code area, I mean the Blockly code area where you drag blocks from the toolbox to make you blockly program.
  3. @Gunners TekZone, @Toastie, I do check for replies and even have three retries... But after 3 retries, if I do not get any reply, well, I just send an error to the chrome console (Press F12 to see the console) and keep going... I'll check if I display an error in the status window, might not do it at the moment. But the thing is, I do not stop the program for this. For the Rcx Input Value block, it does not return a boolean as I showed in a previous post, if the Input is configured as a touch sensor, it will return 0 or 1. See the example in post:
  4. Hello @Gunners TekZone, glad to see you back testing! - No Save As. Indeed, for now I wanted to keep it VERY simple. But I take good note of that... - A saved program doesn't retain and reconnect device connections. But the Name is retained as long as you connect your device BEFORE loading your saved code. As fas as I know, there are no UNIQUE ids for connections and Chrome does not provide the "Com" port number used... I've heard they might give more flexibility in a future version of the web serial api... Anyway, for now, the procedure is, you need to connect to a device to use its Auto generated Device Name in Lego Blocks. For RCX, actually, the Brick does not have to be powered really but the IR tower has to be connected. I still have a note to improve eventually the Device Naming and connect etc. But again, for now, it is VERY simple, Device Name are generated when you connect them, and the Device you select in Lego Blocks are retained in the saved files... But if you load your file when no device connected, the blocs will select no device... It may become difficult if you have many devices, so you may have to take notes LegoB1 is COM19, Rcx1 is COM5, LegoB2 is COM12 etc... - I tried having two RCX's online at the same time: I do not think 2 RCX with the same IR Tower can work... in parallel... I cannot test as I have only one but I do not see the gain... However, 2 IR tower, opposite direction, might work independantly. The MSG instruction trick here is the best I think. Thank you very much for your observations and suggestions. Always VERY appreciated!
  5. @Toastie, I think I fixed the issue with the Function blocks. I tested the following with success: I added a FOOTER and the version should now be: Version: 2026-03-29-1947
  6. I'm glad to see this thread a bit busier ;-) @Toastie, It appears that the function blocks (part of blockly internals) are not working anymore. I must have broken something and will look into that. I don't know much about blockly functions yet but it is a great way to make more object oriented programming. So if your main repeat forever loop becomes more complex, you can use function to modularize your program. When you drag a function block into the code area, you can rename it and it creates automatically in the toolbox, category Functions, a calling block for your function. You can the use the called block into your Main Repeat loop. I don't know but I doubt there is the notion of local variable. I would believe that all variables are Global... I have to test more... Also, when you create input variable for the function, it creates X by default and you can see this x variable in the Variable Category of the toolbox. If you right click on the variable in the toolbox, you can rename it... I think you're right, ChangeOutputA(value or variable) would be the same as a Function with no return value. Let me fix the Function blocks so you can test it without issues.
  7. Both USB to Serial and BT to Serial adapters are seen the same for the online Lego Blockly and it uses the webserial API for both (BT serial adapter generates a "COM" port in the windows device manager for example). I had to do a little something in the code though to have it run on ANDROID phone/tablet as there is no "COM" ports. But it still use the webserial API...
  8. @Wapata, The "Power" must be a number from 0 to 7 (3 bits, 000 to 111 binary), the program "AND"'s your number with 7 (111) whatever number you give, so 8 = 1000 binary AND 0111 = 0000= pwr 0 the lowest power. I just added tooltip on the Lego B power Block to inform about the range 0-7 of the power. As @Toastie said, the LegoBx name is saved with your project (if you use the save button) but you have to "load" back your program after reconnecting your com port(s) that generates the Device Name automatically. I might try to change this in the future but for now, it was for me the simplest way to do things.
  9. Now the Updates should be automatic when you go on the web page. I removed the update button and banner... (But for now, there is not new important updates) Thanks for CC info!
  10. This is good programming. Your first version is intuitive too, but it could send same commands to serial every scan we might think. But I also did some output commands caching in the code (FOR LEGO INTERFACE B ONLY NOT RCX YET) that prevents sending same consecutive commands. There are a couple of exceptions like the REVERSE command which I cannot cache, so care must be taken when using it. I added the "Is Between" block in the logic category. To update, you must go online with chome on my page. Check in the logic category if you see the new [ ] <= [ ] <= [ ] block. If not, To force page refresh, press Ctrl-Shift-R. A banner should appear at the bottom with update button. I'm improving this update thing (the bottom banner that appear gets the blockly scroll bars over it... will be fixed soon). It does (Sensor_2) > 20 AND (Sensor_2 < 200) Note that the first number can be > than the last number. for example, 200 < Sensor_2 < 20 which is equivalent to Sensor_2 >200 OR Sensor_2 < 20.
  11. @Toastie, That makes me very happy to know that my Blockly project can help some people realize some dreams :-) I think you did a very good program. It's intuitive and visually tells what it does. You're right about forever loops, a small wait is required to leave the UI some time to manage things I guess... I'll look after that if it could be implicit... But for now, it's the way to do. And actually, your program gave me the idea to add a new comparison block: A block that outputs True if Input number between min and max number which would replace the bunch of <= and >= and the "AND" blocks you merged to achieve this result. You talk about the Control Center CC and got me curious about this... I don't know what it does... So I'm going to read about this equipment. So, do I understand you tested quite a few things with the Lego Blockly? : - You used the installable feature to install the standalone version to work offline? - You used a BT to Serial Converter? Thanks for the good words.
  12. Ok, here is a little something new: The Lego Interface B Online Blockly is now Installable on your PC (Windows, Linux, OSX etc). It should run offline, without internet (have not tested it without internet yet). It runs as a standalone app without address bar etc. But to install, you must at least connect to internet once to go to the my blockly page and click on this little icon in the address bar:
  13. As I tested previously and successfully, it is very possible with a bluetooth to serial adapter. See: and:
  14. I think I added in my online Blockly for Lego Interface B all the RCX blocks I had previously implemented in my Python RCX module equivalent. The Input Value block returns a number, not a boolean. I have not done a special "boolean" block for the touch sensor inputs. An input configured as a touch sensor will have the inp value block returning 0 or 1. Then in blocks that needs a true false boolean condition, you can always use a "comparison" block. See the following example: first block configures input 2 as touch sensor.
  15. About my problem with the Serial connection, the port with the CH340 adapter was already opened with my other web serial project... So the CH340 adapter is working just great and I manage to use web pbrick IDE to download the program to the RCX successfully. The prolific adapter for some reason gives me problems but anyway, I use it now for the Interface B. It would be neat to have a wait until block but the repeat until empty loop is working very well. That's too bad not much people use RCX anymore cause web Blockly RCX makes programming the yellow brick so much easier and intuitive and time saving! I think Interface B is even less popular now and I feel a bit lonely sometime :-) while developping drivers and IDE for it. Some website are "installable" when you see at the right of the address bar this icon: . This is not the case with @maehw websites and neither with my blockly project. I'll look after what it takes to make a website "installable"... Thanks @maehw for this great peace of work! I will look at your code as I want to have a bottom bar like yours :-)
×
×
  • Create New...