These Utilities will help you make your code more powerful. The Jewelbots Utilities are here to help you! Check them out below.
This function returns a random number in between two integers.
The Timer class constructs an object that allows you to create a delay between other Jewelbot functions or keep track of time since the program started running.
The different functions are called the "API", because they are the way you interact with the device. APIs are ways you can work with different interfaces, sometimes in a computer and sometimes online.
This function pauses your Jewelbot.
This function returns the number of milliseconds since the program finished starting up the hardware. The return value is of type uint32_t.
There are two functions available which allow for outputting messages and variable values from the Jewelbot. The primary objective of these messages is typically for debugging purposes, to learn where and how your program is running. The messages output from the Jewelbot can be viewed on the Serial Monitor. The Serial Monitor is located in the Tools menu of the Arduino IDE. Before accessing the Serial Monitor, the Jewelbot must be plugged in and the proper USB port selected under the Tools -> Port: menu. Once the Jewelbots Friendship Board is selected, there is an example sketch of this functionality under the File -> Examples -> Jewelbots_Examples called USB_output.ino. Before getting to outputting messages, a function must be set up on the Jewelbot to enable the messaging.
The set_run_loop_charging() function sets an internal switch in the code so the Jewelbot will run the loop() function while it is plugged in to USB power. Typically the Jewelbot does not run the loop() function while charging so that the charge status can be displayed. In this case, since the USB must be plugged in for the desired output to be sent to the computer, this function tells the Jewelbot to run loop() while plugged in to power. To utilize set_run_loop_charging(), place the function inside the setup() section of the sketch:
This function prints a string message to the Serial Monitor.
This function prints a string message and variable value to the Serial Monitor.
Both functions follow the standard C formatting rules. The "\n" character in the above examples is for a new line, so each message will start on its own line.