Giottist Posted January 8, 2019 Posted January 8, 2019 If I unstand it correct, we can write small c# code which is executed as a result of different sensor messages. Does the C# interpreter (?) allow loops like for oder do while and branches like if else or case and local variables? Quote
Lok24 Posted January 8, 2019 Posted January 8, 2019 (edited) Hi Cosmik42 , thanks for your quick answer! But: where can I find the "new" version? And, I'm very sorry, more questions: What does a syntax for RampMotorSpeed(Port, 1000,1000) mean? (I assume Port,v,time) And what about others motor types, which can be moved by a specific angle, like Boost or WeDo? (but perhaps they pop up when I attach one) Edited January 8, 2019 by Lok24 Quote
Lok24 Posted January 8, 2019 Posted January 8, 2019 (edited) 44 minutes ago, Giottist said: If I unstand it correct, we can write small c# code which is executed as a result of different sensor messages. Does the C# interpreter (?) allow loops like for oder do while and branches like if else or case and local variables? Yes, I just tried (part of your question): Edited January 8, 2019 by Lok24 Quote
Toastie Posted January 8, 2019 Posted January 8, 2019 Just now, Lok24 said: Yes, I just tried (part of your question): Thank you, Lok24 for this info! (sorry, the "@Lok24" thingy does currently not work on my laptop) I need to catch my breath. My goodness - this is so incredibly cool. I have never seen such a nice piece of software for original LEGO stuff control before. For free. With free and swift support from an extremely skilled C# programmer. With the chance of asking for additional features. And now this: Building your own chunks of code … Unbelievable. TLG should give Cosmik42 all the LEGO BLE devices currently available for free … Again: Thanks a million Cosmik42, for doing all this for us!!! All the best, Thorsten Quote
TheLarry98 Posted January 8, 2019 Posted January 8, 2019 19 hours ago, Cosmik42 said: @TheLarry98, insteresting. I just made a debug version for you: Can you download it, run it and let me know if the hub shows up? It now works. Thank you very much! Quote
Cosmik42 Posted January 8, 2019 Author Posted January 8, 2019 (edited) 1 hour ago, Lok24 said: But: where can I find the "new" version? The V0.3 link at the top of this thread. Here it is again: https://www.dropbox.com/sh/g32wsw502jwv6oj/AAC0EycS7kgCIluhtVmKt1k3a?dl=1 1 hour ago, Lok24 said: RampMotorSpeed(Port, 1000,1000) It should be RampMotorSpeed(Port, Speed, Time), so it will look like this: RampMotorSpeed("A", 70, 1000) where 1000 is in millisecond and is the total time of acceleration/decelaration. Edited January 8, 2019 by Cosmik42 Quote
Bartosz Posted January 8, 2019 Posted January 8, 2019 @Cosmik42 pardon if it's been asked/answered somewhere in this thread - is the source available /is it going to be open sourced? Quote
Cosmik42 Posted January 8, 2019 Author Posted January 8, 2019 44 minutes ago, Lok24 said: Yes, I just tried (part of your question): BTW - You can write "MainBoard.WriteLine("...."); to log in the program's console. 9 minutes ago, Bartosz said: @Cosmik42 pardon if it's been asked/answered somewhere in this thread - is the source available /is it going to be open sourced? For now there's no clear plan on releasing the source officially, mostly because it is a side project and the code is really ugly :D 41 minutes ago, Toastie said: Again: Thanks a million Cosmik42, for doing all this for us!!! Thank you @Toastie! Quote
Bartosz Posted January 8, 2019 Posted January 8, 2019 12 minutes ago, Cosmik42 said: For now there's no clear plan on releasing the source officially, mostly because it is a side project and the code is really ugly :D Some people would agonize over making it pretty/portable and never get to anything, whereas others would "just do it" :) I guess just take care of releasing it before you get bored/go MIA (as it, unfortunately, often happens ;) ). My myself I do not own any PU hub yet, so I don't have any real interest in this software, but - just in case (and since I'm programmer as well:) ) Quote
Toastie Posted January 8, 2019 Posted January 8, 2019 5 minutes ago, Bartosz said: I guess just take care of releasing it before you get bored/go MIA (as it, unfortunately, often happens ;) Oh yes. This is probably how it is - everywhere. I am not a programmer, I do sort of independent research - in ion chemistry. Sometimes people get very excited about what my group does … I am/we are getting excited about that reaction as well … and then … after weeks, months … maybe even years … something else catches your attention … and you are carried away … without publishing anything. I guess it is what you meant, isn't it? All the very best, Thorsten Quote
Lok24 Posted January 9, 2019 Posted January 9, 2019 Hi , thats's great. I now spend some time with your program, and there are some small issues that are not quite clear to me, would you discussed it here or via private message ? Quote
Cosmik42 Posted January 9, 2019 Author Posted January 9, 2019 8 minutes ago, Lok24 said: I now spend some time with your program, and there are some small issues that are not quite clear to me, would you discussed it here or via private message ? Absolutely! I just created a separate post with a clear example and a link to the very latest version: Quote
Cosmik42 Posted January 11, 2019 Author Posted January 11, 2019 So, happy to report we officially support PU lights. Just received a set today and plugged it up for a short test! Quote
Cosmik42 Posted January 13, 2019 Author Posted January 13, 2019 (edited) Wow. I have a working prototype of controlling motor and lights on a SBrick! The only thing weird is that SBrick abruptly disconnect with me randomly. Did anyone here implement the SBrick protocol? Edited January 13, 2019 by Cosmik42 Quote
Conchas Posted January 13, 2019 Posted January 13, 2019 SBrick has long history of abrupt "disconnections". The developers struggle to develop a Android App capable to sustain a stable a connection with SBrick. When you try to use three of them it is virtually impossible to maintain a connection with all simultaneously. Quote
Cosmik42 Posted January 13, 2019 Author Posted January 13, 2019 Just now, Conchas said: SBrick has long history of abrupt "disconnections". The developers struggle to develop a Android App capable to sustain a stable a connection with SBrick. When you try to use three of them it is virtually impossible to maintain a connection with all simultaneously. Do I need to update the firmware of the SBrick itself? Quote
Conchas Posted January 13, 2019 Posted January 13, 2019 Yes, should use the latest firmware! Not guaranteed it will improve your experience though... Quote
Cosmik42 Posted January 13, 2019 Author Posted January 13, 2019 I confirm. Firmware update fixed the issue! We are just few hours away from officially supporting SBrick! Quote
mawe Posted January 13, 2019 Posted January 13, 2019 I love this project. I have some SBricks and a couple of Powered Up's. Now I can use them all together and don't have to update all my trains. I also have a tilt sensor and a distance sensor compatible with the SBrick. Let's see if this works :) Where can I donate? Quote
Cosmik42 Posted January 13, 2019 Author Posted January 13, 2019 Hi Mawe! Thanks for the kind words. I still need to release this SBrick support. Hopefully tonight, if not tomorrow. I don't own an SBrick Plus yet. So I don't support sensor from SBrick just yet. But as soon as I can find a device it will be done! Thanks for following my work. Hope it is helpful to you! Quote
Cosmik42 Posted January 13, 2019 Author Posted January 13, 2019 On 1/8/2019 at 7:06 PM, Giottist said: Does the C# interpreter (?) allow loops like for oder do while and branches like if else or case and local variables? Sorry @Giottist, I totally missed your post. Yes indeed! You can in fact use everything C# has to offer since the code is fully compiled and executed on demand. This a powerful tool to write complex behaviors and scripts! Quote
Tlego Posted January 13, 2019 Posted January 13, 2019 Cosmik42, love this software. I’ve got a couple of trains running successfully, now just need more PUPs..... i noticed the software picks up the remotes, any plans to be able to use inputs from these to trigger events? i.e. press a button on the remote and it executes the code, or just be able to control the trains with the remote. Quote
Giottist Posted January 13, 2019 Posted January 13, 2019 1 hour ago, Cosmik42 said: @GiottistYou can in fact use everything C# has to offer since the code is fully compiled and executed on demand. This a powerful tool to write complex behaviors and scripts! Cool. My idea is to introduce the SerialPort class into my C# code enabling the communication with the Arduino world. It can be useful to save limited BT channels for the moving trains and let Arduino controllers serve the switch motors and readout fixed sensors besides the rails. Hmm, promising At the moment I am somewhat busy but this is real motivation to get experience with C# code in the train software. Let me a little time. Quote
Cosmik42 Posted January 13, 2019 Author Posted January 13, 2019 Just now, Giottist said: Cool. My idea is to introduce the SerialPort class into my C# code enabling the communication with the Arduino world. It can be useful to save limited BT channels for the moving trains and let Arduino controllers serve the switch motors and readout fixed sensors besides the rails. Hmm, promising At the moment I am somewhat busy but this is real motivation to get experience with C# code in the train software. Let me a little time. That would be amazing! 45 minutes ago, Tlego said: i noticed the software picks up the remotes, any plans to be able to use inputs from these to trigger events? i.e. press a button on the remote and it executes the code, or just be able to control the trains with the remote. It's a great idea! I add this to the TODO :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.