Jump to content

Bliss

Eurobricks Citizen
  • Posts

    145
  • 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,200 profile views
  1. 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.
  2. 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 :-)
  3. @maehw, I just discovered your work here. That is great! I tried both Blockly NQC and WebPBrick IDE. Is it me or there is no "UNTIL" in the blockly? in NQC, I had the following line: until(Message() == 11 ); . And I do not find a matching block for until. I had to use repeat until which is not the same...
  4. While adding RCX communication to the Online Blockly project, I have broken something yesterday for the connection of Lego B but it should be fixed now. So as I said, I am trying to add RCX comm (IR Tower) to the project. It is not to upload programs into the RCX. For this, you still need to use Not Quite C (BricxCC?) or other means. It is only to send basic commands to RCX. This allow interacting betweens multiple Lego B's and RCX's somehow using my Lego Blockly Online UI... For now I did only the Motor commands and Sound and Check if Alive Blocks. I will add more blocks in the next days... The web serial API is more sensitive/picky compared to the pyserial module for python. Python ignores parity errors etc but not the web serial so I had to adjust some timing and even then, I still get parity errors but I ignore them and allow 3 retries (resend the command if no replies detected after parity error.). Communication with the IR hub is only 2400 bauds and is half duplex. It is not the most reliable... But it is working. Example:
  5. MQTT is a very popular protocol in IoT world especially smart homes... I find it very relevant even for Lego controllers to allow them to communicate with external world... So while developping "Drivers" for old lego stuff, if it is possible, why not integrate MQTT client as well. I find myself this "add-on" to be great. I have a small PC that runs Home Assistant with MQTT and Node-Red Addons... I could use an IKEA Zigbee button to interact with my lego interface B and RCX through MQTT. So yes, it is relevant for some of us but not mandatory to operate the Lego Bricks. Just an amazing addon that is worth to talk about, at least a little ;-) . And since I'm doing some Javascript for the Online Blockly project, I'm thinking maybe eventually to bring the Lego Interface B JS driver into Node-Red ... But this is another project...
  6. Ok, good news. After many trials and gemini/copilot incomplete replies to my request, I managed to have a code to connect to android through an HC-05 BT/serial adapter (As my picture few post behinds). It should still work on the other plateforms like windows, osx, linux as usual with a serial adapter or HC-05 but I had to use some filters in the JS code to allow connections on android with a BT device. So for Android, for the moment, YOU MUST use a HC-05 or alike board. HC-05 uses standard Bluetooth. HM-10 board is a BLE board and should be compatible with Chrome but I think I would need to use another API in my code like WebBluetooth or something like that which I'm not ready for now... IMPORTANT: You must update your Chrome on Android with the latest version. 1- Make sure your Chrome is updated above version 137... 2- Pair your HC-05 Board using the key pass 1234. 3- You must use a TTL to RS232 as shown in my setup few posts before. Connect RX from HC-05 to RX on the TTL/RS232 adapter, and TX to TX... 4- Connect your RS-232 to TTL DB9 to the Interface B. You may need a sex changer. 5- Go in chrome on you android device / tablet and open my blockly page: https://blissca.github.io/lego-blockly/index.html 6- Click connect. It may ask you for permission which you should allow. Then it will show you the HC-05 that you select and connect. I tested on an Android phone, it's working but it would be way better on a tablet.
  7. Yes, So, while a WAIT time block would pause the execution of a program and resume after the time as elapsed, the "After time do" block will let the program continue after it starts. (It starts after the program "read" the block indeed) This allow to do sort of multi tasking as shown in my last example.
  8. I added new unblocking timers in the Control Category. Unblocking means that it will not block your "Flow" as will do a WAIT Time block. It's very powerful and versatile but you must be carefull, especially when using it in repeat forever loop. Every time you call "After time DO", it creates a new timer instance... The "Named Timer after time do" version allow to name a timer and you can cancel the timer before it reaches its time preset with the Named Timer Cancel Block. Every time you call a same Named Timer block, it restarts at 0 even if not completed a previous call. Examples: This is not in a loop, so it executes the flow from top to bottom and finishes in a fraction of second. This will start a timer 5 sec, and activate output B while out A stays off and finish the program immediately (prints Finished in the status window) After 5sec the program is finished, the Output A will be activated and Output B will turn OFF! In the examples above, you have 2 versions of the program uses a repeat forever loop with a scan time of 0.05 sec. Left program uses the "after time do "block" and the other one uses the Named version. The left one, if you keep pressing touch sensor on Input 1, it will create like 20 different "after time do" instances... The right one, if you keep pressing input 1, it will keep restarting the timer T1, thus, it will start to count the time when you release the touch sensor... So in the DO part of this timer, someone could even think to put another repeat loop and start a separate process... But be carefull... It could generate write faults to the serial as it could try to send commands at the same time... I will implement a command queue for the serial write... will be done in the next update... In the above example, the Output A is flashing on/off (0.5s on, 05s off) while you can use the touch sensor on input 1 to control independantly the output B with a very good responsivness. EDIT: I added even more timer function to help with the Named Timer block (Timer is Done?, Timer is Running? etc) So I updated also the example above). I noticed that if you go on another tab in the same chrome window, the blockly program is not responsive so you must stat in the Lego Blockly tab while executing a program. So it's better to run a program in its own chrome window... (Keep the window maximized as it aslo slow down the program when minimized)
  9. @Gunners TekZone, I'm planning to add MQTT Client support to the my Lego interface B Blockly Online version eventually, if it is doable... With MQTT Client, you should be able to exchange data between Interface B Running Blockly in Chrome and Interface B running with ESP32 and Micropython... and any other MQTT enable devices in your smarthome...
  10. Rotation sensor for me is quite accurate but has its limits. If you turn too fast, it will loose precision. There are only two bits for the amount of change since last frame... These 2 bits represent the "speed" amount and is used to increment the counter. Increment can be 0, 1, 2, 3. 3 is the max speed. Also, you may have a faulty sensor...
  11. @Toastie, thank you. I hope you'll have time to test this and I'm looking forward to read your comments and suggestions too... Why did I start this other Interface B project? @AJB2K3 is working on a standalone version Blockly programming for Lego Interface B and RCX but still need quite some intallation... Did not try his new exe installation package... But I liked the idea and interface. @maehw is designing a web UI to TEST the Interface B that is also a great project since it does only need a Chrome browser. So all this gave me the idea to try to create an ONLINE web programming interface for MULTIPLE Lego Interface B's. The ultimate goals being: No install besides having chrome or edge on your PC, Linux, OSX, Android computer/tablet. And of course having the hardware required. Simple and intuitive programming language for end user. Blockly is hard to beat and I've read that it is even used in Smart Home software like OpenHAB.. And I must admit that I have lots fun dseigning this with the help of AI. I wasn't sure with blockly realy, having played a bit with UIFlow by M5Stack for programming ESP32's, which is blockly based and for serious big project, it might be ugly I think... But the simplicity is unbeatable. Then, after I had the first draft ready, I had great fun trying things in blockly to control my interface B. And the more I add blocks and features, the more I like the Blockly IDE now lol... I have a bunch of ideas to improve and add fonctionalities. Stay tune for more...
  12. Well, my mind have seen first a flower but it would have been grey, maybe it would have seen a gear ;-) I made a BIG change for the output port letters haha. (Not that big after some digging). Thanks @Gunners TekZone for "insisting" haha. I also think it is better that way and also, it does not affect at all the possibility to use variables and numbers.
  13. That's about it. An Android phone or tablet using wifi to access my Lego Blockly Web Page with chrome and use the BT to RS232 adapter that makes com port available to the phone. The BT to RS232 is plugged to the Interface B. On the web page, then press connect and select the com port from the BT adapter and it will connect to the Interface B. This has to be proven to work on Android. IT IS WORKING ON MY LAPTOP (Win11) that has BT... I will have an android phone to test this Sunday. Can it do Multiples Interface? I guess so if you have multiple BT to RS232 adapter :-)... Here is my DIY BT to RS232 adapter that works with my PCs... You probably have all components except the BT to TTL maybe (HC-05 or alike, this one is a JDY-31-SPP) The RS232 port of the TTL-RS232 adapter goes to the interface B. That eliminates the USB/RS232 adapter plugged to a PC. It make the Interface wireless somehow but the program is still running on a PC, not an ESP32 like the last year project... But I di not test it for very long with my PC and I don't know if this wireless method is reliable...
  14. I was being asked on github by @Wapata if this would work on an android phone or tablet... iPhone do not allow webserial :-( So, for Android, I read that it could work with a USB OTG Adapter (On The Go) + Serial USB/RS232 adapter but they also say there are limitations... But google also say that could work better with a Bluetooth to RS232 passthru adapter... I do not have a complete BT / Serial adapter But I found out I ordered in 2023 some BT FTDI board like HC-05, JDY-21 etc... And for the ESP32 project to hook to Interface B, I had to get some TTL to RS-232 adapter... I got some spare too... So I connected the BT / Serial TTL to the TTL - RS232 adapter to make a BT / RS232 adapter and plugged the RS232 port to the Interface B. I opened the Add BT Device on my computer and saw the JDY-21 device and paired it (passkey is 1234 with these little boards). This automatically added Com ports... So in my Blockly page, I click connect, and select the COM Port generated by the BT / Serial board and to my surprised it worked! So I was able to control the Interface B Wireless through BlueTooth! I'm gooing to borrow some old Android phone from my nefew Sunday and let you know if it can work from an android device with chrome and BT...
  15. @Gunners TekZone, you could use letters for output if you can't live without it by creating variables... or The last example is here: https://github.com/BlissCA/lego-blockly/blob/main/Examples/legoB_OutLetters.json
×
×
  • Create New...