I have had many requests in the past from people making projects who wanted to use MRL, but did not know how to incorporate it in their "already running" projects.
In the past MRLComm.ino was a sketch which you had to load into your Arduino in order to use MyRobotLab. But now, there is a kinder / gentler MRL ! It's now an Arduino library !
Now how can you use it with your own sketch!
Here is a very basic example. It only shows how to use the MRLComm library and get all the functionality which was previously in the MRLComm.ino sketch .. But wait there's more ! You may want to send some of you sensor data to MRL. NO PROBLEM (in fact Alessandruino wants to do this from his MPU06050)
I don't have a MPU06050 - so I'll just show you how to get 3 variables from your Arduino sketch into MRL using the MRLComm library (ax ay & az)
Setup is pretty easy - create a MRLComm object .. I chose to call my mrl (clever no?)
mrl will want a serial connection - so I gave it my Mega's first serial connection.
And now to get all the functionality MRLComm.ino had all you have to do is call mrl.process() in the loop.
Typically its very fast.
Now to send 3 variables back to MRL (specifically python). Here's our Python script ..
And thats it !
available in 1.0.57
You will need to load the library like all Arduino libraries - this is well documented here -
The library itself can be found here - https://github.com/MyRobotLab/repo/blob/master/cc.arduino/1.0/MRLComm.z…
- The skeleton & what is now needed as the "main" MRLComm.ino is in the zip - it has very little code - same as what is posted in the previous pictures.
- Only ints are currently handled - other data types unsigned longs, longs, byte, char will be added in the future.
- There still needs to be a way to pass information from python (or other services) - to the Arduino sketch