INTRODUCTION
The BlendixSerial library is designed to work in conjunction with the blendixserial addon in Blender. It allows for controlling objects in Blender using serial communication with an Arduino or other microcontrollers. The library provides functions to set coordinates and text for the objects in Blender, as well as retrieve a formatted output string.
INSTALLATION
- Download the library files from the given link.
- Extract the downloaded files.
- Copy the entire extracted folder into the Arduino libraries folder. The default location for this folder is:
- Windows: Documents\Arduino\libraries
- macOS: Documents/Arduino/libraries
- Linux: Documents/Arduino/libraries
- Restart the Arduino IDE if it was already open
API REFERNECE
BlendixSerial()
- Constructor for the BlendixSerial class.
- Initializes the coordinates array.
void resetCoordinates()
- Resets all coordinates in the coordinates array to zero.
void setCoordinates(int setNum, int xVal, int yVal, int zVal)
- Sets the x, y, and z values for a specific set in the coordinates array.
- Parameters:
- setNum (int): The set number (1 to 3).
- xVal (int): The x value for the set.
- yVal (int): The y value for the set.
- zVal (int): The z value for the set.
void setText(String inputText)
- Sets the value of the text variable.
- Parameters:
- inputText (String): The text to be set.
String getFormattedOutput()
- Returns a formatted string containing the coordinates and text data.
- The coordinates are concatenated with commas and each set is separated by a semicolon.
- Example output: “10,20,30;Hello, Blendix!”
USAGE
Include the library at the top of your sketch:
#include <BlendixSerial.h>
Create an instance of the BlendixSerial
class:
BlendixSerial blendix;
Set the coordinates and text using the provided member functions:
blendix.setCoordinates(1, 10, 20, 30);
blendix.setText("Hello, Blendix!");
Retrieve the formatted output using the getFormattedOutput()
function:
String output = blendix.getFormattedOutput();
The output string will contain the formatted coordinates and text data.
Use the output string as needed. For example, you can send it over a serial connection.
Serial.println(output);
EXAMPLE SKETCH
Note: Make sure to include the `BlendixSerial.h` header file and create an instance of the `BlendixSerial` class before using its methods.
The BlendixSerial library can be used in combination with the BlendixSerial addon in Blender to control the objects’ coordinates and text in real-time from an external device via serial communication. Refer to the provided example sketches in Library for more usage scenarios and ideas.