LocalLan working in live mode not after having uploaded


#1

Hello,

I’m trying to build a Quiz buzzer with multiple HaloCodes by connecting them to a local lan. I have one master and the rest are slaves. The master creates the local lan and then the slaves send a “InitID” value with “ID” concatenated with a random number between 1 and 100. This to be able to differentiate between different slaves. Upon reception of this message the master sends back a message using the ID of the slave as type of message and a color value as value (e.g. red, blue, green,…). Of a slave sees a message with its own ID it sets a led to the color the master has sent him.
Then there is some more messaging once we press the button on the master to open the round and then when a slave pushes a button it sends it ID, so the master knows who was first. The master then confirms which slaves was first by sending a message back with the ID that has one so it start blinking all the lights.

All of this works when I have the master connected in live mode to my laptop and a slave to my desktop but once I try to use the same application after having it uploaded it doesn’t work. If I but the master in upload mode and the slave in live mode, I can see that the slave sends the message with its ID but doesn’t get back the confirmation of the master with its assigned color. However if I connect the master in live and the slave in upload mode, I can see that the master does send the message.
Any ideas why this is working if both master & slave are in live mode and not if they are in upload mode.

I do see that the halocodes run a lot slower when running in live mode. I’ve also noted that if you connect 2 halocodes through USB to the same PC and have two instances of mblock open. The one mblock ide that is being viewed is faster than the one running in the background.


#2

Hi ElLoco,

It’s been a long time since I did a LAN project but Halocodes work without mBlock … Upload mode should work. Do you want to share your code ???

If I understand correctly … You will ask questions and the students will have to answer with a Halocode (4 possibilities with the capacitive buttons).


#3

The purpose is to create a Quiz Buzzer with 4 slave halocodes and 1 master. First the master is started and creates the local lan, then each slaves is started and connects to the local lan with a random ID which it shares with the master. The master sends back a confirmation by sending a message of type “the ID of the slave” with a color assignment. This part doesn’t work in upload mode but works perfectly in live mode. The purpose of the random ID is so I can use the same code for all slaves. I had to concatenate the number with ID as you can’t broadcast message with just a number.
Sorry for the messy bit with all the variables being set but I need this for the other part of my program. If you think this other part might interfere I’ll share the complete program, but I’m struggling with just the first “handshaking” as the slave doesn’t seem to be listening/seeing the message with its ID in upload mode. I thought maybe it had to do with some timings as the Halocodes are a lot faster when not in live mode so that is why you see the different “wait” blocks. :-):roll_eyes:



#4

Hi ElLoco,

I have looked at your problem with the objective of successfully finding your mistake. I also built your project from scratch. Unfortunately, there is simply no mistake. There seems to be a real problem.

So I started over with a super simple program to demonstrate to Makeblock that there really is a problem in UPLOAD mode.

  • Upload the Halode2 (Slave)

  • Disconnect Halode2 (Master), Connect, Play (Live mode) = OK

  • Upload the Halode2 (Slave)

  • Disconnect Halode2 (Master), Connect, Upload = BAD

I’ve tried pretty much everything and noticed the problem a few months ago but thought it was my code.

I hope Makeblock can explain the different behavior depending on the mode because UPLOAD is much more interesting for me. Unfortunately, it doesn’t work well.

Quiz-2.zip (4,7 Ko)


#5

Hey Crackel,

thanks for confirming you also have the same problem. I raised a ticket with support to see if they can assist.

I rebuild your program to use Wifi and then it seems to work. If you add the user cloud messaging extension you can debug it through the sprite. Not ideal especially if you don’t have Wifi nearby.

Update values of Wifi_SSID & Wifi_PSK variables to test.
Wifi-messaging.zip (52.8 KB)


#6

A few months ago I made a multiplayer game and had to use WIFI. Probably because the LAN is finicky?

I hope Makeblock will look at the code … there really is a problem.

Code


#7

Hi ElLoco,

The replacement you made in my code shows that the WIFI is working and that there is a problem with the LAN. Makeblock should correct because the LAN is much more convenient when we do not have WIFI …

Thank you


#8

I agree that using LAN in Live mode is also more convenient to debug. Especially for youngsters this is useful.
No reply to my support ticket yet.


#9

Tried converting my program to only have slaves and use a laptop as master through a sprite. However I faced again the same issues. Did some more debugging and finally found out you can’t use dynamic names for the message names. So in the example attached if I drop the HC_ID balloons in the “when receiving user cloud message”, even-though the name is a static value ‘slave’, the program doesn’t work anymore. All message names need to be defined up front. Unfortunately there are not a lot of string manipulation functions in scratch/makeblock so it is not that easy to work around this in a dynamic way. Easiest option is just to use fixed names. No response on my initial support ticket, might create a new one with my additional findings.


Quiz-PCasMaster-HaloCodeSlave.zip (59.4 KB)


#10

Hi ElLoco,

Nice observation, I will look at this.
Did you know that CyberPI has 2 super interesting possibilities. We can know the name of CyberPI and rename it and know it is MAC. This makes it possible to identify the material … I asked for the same functionality for the Halocode … I hope that this will be retained


#11

Hi ElLoco,

I was having a lot of trouble with your code because of the Cloud … The behavior was crazy.

Following the REBOOT of the Makeblock server, your code works great. Yes, putting a variable is functional …
2021-06-25%2015_14_50-Window

Please try your code again …


#12

thanks for confirming you also have the same problem.