Randomised function for Arduino/C++ robot. Convert JavaScript

Budget 64$ per month
Posted: 4 year ago
Opened
Description
Hello

I am a fairly competent JavaScript developer and have a function working to control a robot vehicle.

I need the code or functionality converting to C++ to upload to an Arduino robot.

The premise of the functionality is this:

Generate random number between 1 and 2 (in JS we would use 0 and 1, so whichever works for C++)

If randomNumber === 1 initialise drawLine function, else initialise drawArc function.

drawLine and drawArc also need to contain a randomised number parameter (so generate a random number from 1 - 100, for example, and activate the motor for that length/duration).

The randomNumber function should loop continually.

Hopefully the Javascript function shows this clearly. You can find this here: http://jsfiddle.net/lharby/db6oyz1w/
but I will also try and attach files (I ad to convert the js file txt). Note that if you visit http://apps.mirobot.io/javascript/ you can cut and paste the js code and see it working.

I have tried to write the C++ code myself but I am finding it a minefield and very different. I did start a post on here which did not go very well: https://forum.arduino.cc/index.php?topic=639264.0

I don't need to understand exactly the paradigm, but I need to be able to modify parameters in the function so I can alter the way the robot behaves. So commented code would be great.

I would like to be able to test the code on my Arduino by 18.10.19

I'm sorry I don't have a huge budget, based on how long it took me to the write the JS and hopefully converting it, I am hoping someone will be happy to take this on.

Any questions please do not hesitate to give me a shout.
Skills:
arduino,C++ programming language,software development
Category
Source: peopleperhour.com

Add a bid

days