Scratch programming of VR408


#1

Hi I bought a VR408 kit a few days ago. My goal would be to use it with the Scratch programming environment.

Everything worked fine (with a few small issues but not impossible) up to the last step:
When connecting to the robot from Scratch and running a command - the first gets executed correctly and NO other command works afterwords (like the serial communication gets broken completely)…

The only error I had when following the installation and connection tutorial was a warning of compilation for the Scratch Sketch.ino:

" warning: attempt to free a non-heap object ‘BOT’ [-Wfree-nonheap-object]

free(ptr);"

This has also been asked (and not answered) in another topic: Errors compiling Scratch-Sketch VR408Scratch.ino

Anyways that is JUST a warning and the connection seems to work (for a command ONLY) …
Does anybody have ANY ideas on what should I do to correct this ?

Thank you in advance !


#2

hi!
are you using a laptop?
If so please try disconnecting t the power supply of your laptop. And reconnect the allbot with your laptop. Also restart the communicator

best regards
VEL337


#3

Thank you very much for your reply.

Yes I am using a laptop. I just tried what you suggested - unfortunately with the same result !
For a more detailed description of this problem, this is what I’m doing (step by step):

  • with my laptop power wire plugged off:

  • connect my robot on USB - chirp sounds signals correct VR408Scratch is loaded

  • power on the robot (from the VRBS1 shield button) - the robot stands up

  • start the Allbot communicator software = the robot restarts (powers off and on again with chirp and standup)

  • press Connect from within the Communicator software - the robot restarts again (powers off and on again with chirp and standup)

  • start Scratch - import extension

  • IF I did the above fast enough (within 30 seconds or so) - I get two or at most 3 Scratch commands executed. After a while - NO new command gets executed anymore and whenever I click within Scratch on a command it gets like this:
    Blocked Scratch command until I click it again…

Its like the serial communication is not working anymore and I have to REDO all the above…

Any other ideas ?

Thank you again for your time and effort,
Best regards,
Dan


#4

Hello Dan,

Did you find some solution ?

I’ve got exactly same problem, even with Scratch or IR Remote : transmision works only for a few time…

Sincerely,

Alain.


#5

A question which arduino sketch did you load in the Arduino?


#6

I did find a solution, indeed - after checking for a while…

It seems that there is a debug code that is left over inside the SerialBot.cpp (check under C:\yourUser\documents\arduino\libraries\Allbot\src) -

void SerialALLBOT::update(void)
{
checkAndHandleCommand();
//sendStatus();
}

On the update function which is called continuously - there is a send status call that is also called continuously ! This command sends the status of the arduino pins in a loop (forever) which fills the buffer of the Serial port within a few seconds or so…

You can check this by opening a Serial Monitor from the Arduino IDE and setting the speed to 115200 (the speed setup in the Vr408Scratch in the setup() )

Now - this was most probably a debug code - the idea is that we do not need it. and It DOES interfere with the robot controlling and therefore should be commented (as it is in the code above)…

I AM a bit disappointed by Velleman though for not properly solving this - I had to solve it all by myself !

I hope this helps,
Dan


#7

VR408Scratch - check the previous answer for the solution on this problem ! I’m guessing that YOU should have been the one providing this solution :stuck_out_tongue:


#8

Woops overlooked that one.

The sendStatus function is not debug code.
There’s I/O functionality in the scratch blocks and we need to have feedback of the current I/O status


#9

Then there is something wrong with it as it stops the communication after a while…

Maybe you should finally handle this correctly and provide a solution in that case ??

Thanks


#10

Hi

Can you try this library?
http://downloads.velleman.be/7bc4f0bc45daecfffbe4058275de295c/ALLBOT.zip

Thanks!
There’s now an 500ms delay between each sendStatus call (non blocking)