Jump to content

Recommended Posts

Posted

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?

Posted (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 by Lok24
Posted (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):

untitled2er.png

Edited by Lok24
Posted
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 

Posted (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 by Cosmik42
Posted
44 minutes ago, Lok24 said:

Yes, I just tried (part of your question):

untitled2er.png

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!

Posted
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:) )

Posted
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 

Posted

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 ?

Posted
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:

 

Posted (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 by Cosmik42
Posted

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.

Posted
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?

Posted

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?

Posted

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!

Posted
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!

Posted

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.

 

Posted

 

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 :grin:

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.

 

Posted
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 :grin:

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 :)

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