This secction was ported from (justinknight93/Doolittle)[https://github.com/justinknight93/Doolittle], who made a very nice job with its JavaScript interpreter
Some changes were made and some new functions were added, and more are to be add.
Bellow you can find some of the
Description: Sets the script to be executed next when the current script ends.
Parameters:
script
(string): The JavaScript code as a string to be loaded.
Returns: void
Description: Prints the given message to the Serial monitor.
Parameters:
message
(string): The message to print.
Returns: void
Description: Returns the current time in milliseconds since the epoch.
Returns: number
: The current timestamp in milliseconds.
Description: Pauses execution for the specified number of milliseconds.
Parameters:
ms
(number): The number of milliseconds to delay.
Returns: void
Description: Sets the digital value (HIGH or LOW) for a specified pin.
Parameters:
pin
(number): The pin number.value
(boolean): The value to write (true for HIGH, false for LOW).
Returns: void
Description: Configures the specified pin to behave as an input or an output.
Parameters:
pin
(number): The pin number.mode
(number): The mode to set (INPUT, OUTPUT, etc.).
Returns: void
Description: Get and integer from 0 to 100 relative to the battery level.
Returns: number
: 0-100 battery level.
Description: Get and integer from 0 to 100 relative to the battery level.
Returns: string[]
: "StickCPlus", "StickCPlus2", "Cardputer", "Core2", "Core", "CoreS3/SE".
Description: Open Bruce WiFi connection menu.
Description: Disconnect Wifi.
Description: Performs an HTTP GET request to the specified URL. Optionally includes headers.
Parameters:
url
(string): The URL to send the GET request to.headers
(string[]): An array of headers to include in the request. Headers should be provided as key-value pairs in the array. Example:[ "Content-Type", "application/json", "Authorization", "Bearer your_token_here", "Accept", "application/json" ]
Returns: object
: An object with two properties:
response
(number): The HTTP response code.body
(string): The response body.
Description: Creates a color from the given RGB values.
Parameters:
r
(number): The red component (0-255).g
(number): The green component (0-255).b
(number): The blue component (0-255).
Returns: number
: The color value in 16-bit RGB format.
Description: Sets the text color for drawing operations.
Parameters:
color
(number): The color value in 16-bit RGB format.
Returns: void
Description: Sets the text size for drawing operations.
Parameters:
size
(number): The text size multiplier.
Returns: void
Description: Draws a rectangle with the specified parameters.
Parameters:
x
(number): The x-coordinate of the top-left corner.y
(number): The y-coordinate of the top-left corner.width
(number): The width of the rectangle.height
(number): The height of the rectangle.color
(number): The color value in 16-bit RGB format.
Returns: void
Description: Draws a filled rectangle with the specified parameters.
Parameters:
x
(number): The x-coordinate of the top-left corner.y
(number): The y-coordinate of the top-left corner.width
(number): The width of the rectangle.height
(number): The height of the rectangle.color
(number): The color value in 16-bit RGB format.
Returns: void
Description: Draws the specified text at the given coordinates.
Parameters:
text
(string): The text to draw.x
(number): The x-coordinate where the text starts.y
(number): The y-coordinate where the text starts.
Returns: void
Description: Returns the width of the display.
Returns: number
: The width of the display in pixels.
Description: Returns the height of the display.
Returns: number
: The height of the display in pixels.
Description: print a jpg image in the screen.
Parameters:
FS
(string): "SD" or "LittleFs".Path
(string): File path, ex:"/boot.jpg"
.x
(number): The x-coordinate where the text starts.y
(number): The y-coordinate where the text starts.
Returns: void
Description: Return the current state of 'Previous' button;
Returns: boolean
: Returns true
if pressed and false
if not pressed
Description: Return the current state of 'Select' button;
Returns: boolean
: Returns true
if pressed and false
if not pressed
Description: Return the current state of 'Next' button;
Returns: boolean
: Returns true
if pressed and false
if not pressed
Restriction: Works only in Cardputer
Description: Returns the current state of the keys pressed on the M5Cardputer.
Returns: string[]
: An array of strings representing the pressed keys. Possible values include "Delete", "Enter", "Alt", "Tab", "Function", "Option", or the actual key character.