The Kortexino API is very simple. It just contains two objects:
The Kortexino Object, which represents the information transmitted from the Kortexino app via Bluetooth.
The Robot Object, which represents the state of the Kortexino bot motors.
You can download the library with an empty Arduino project here.
Check out the manual for additional information.
Represents the information transmitted from the Kortexino app via Bluetooth
Variables:
bool kortexino.data_available
True, if data was received via Bluetooth
bool kortexino.face_detected
True, if a face is currently being detected
byte kortexino.face_distance
The distance between the detected face and the iPhone in cm
int kortexino.yaw_to_bot
The yaw angle (i.e. left vs right) between the detected face and the iPhone in positive or negative degrees
int kortexino.pitch_to_bot
The pitch angle (i.e. up vs down) between the detected face and the iPhone in positive or negative degrees
int kortexino.roll_to_bot
The roll angle (i.e. face roll clockwise vs anticlockwise) between the detected face and the iPhone in positive or negative degrees
byte kortexino.smile
Detected smile face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.tongue_out
Detected tongue out face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.kiss
Detected kissing lips face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.mouth_open
Detected open mouth face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.wink_left
Detected wink of left eye face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.wink_right
Detected wink of right eye face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.brows_down
Detected eyebrows down face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.brows_up
Detected eyebrows up face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.teeth
Detected gnash teeth face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.eyes_wide
Detected eyes wide open face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.mouth_down
Detected frowning lips face expression (number between 0-255 corresponds to 0-100%)
byte kortexino.eyes_closed
Detected both eyes closed face expression (number between 0-255 corresponds to 0-100%)
int kortexino.compase
Compass heading in degrees
int kortexino.gyro_x
Direction of gravity (x component of 3D vector) between -100 and 100 (corresponding to -1 and 1)
int kortexino.gyro_y
Direction of gravity (x component of 3D vector) between -100 and 100 (corresponding to -1 and 1)
int kortexino.gyro_z
Direction of gravity (x component of 3D vector) between -100 and 100 (corresponding to -1 and 1)
Functions:
void kortexino.read_data()
Read data received via Bluetooth into the kortexino object.
Represents the state of the Kortexino bot motors
Functions:
void robot.start()
Initialize the Romeo BLE micro controller.
void robot.move_forward(char motor_speed)
Set the speed of both motors to move the robot forward. char motor_speed: set to a number between 0 and 150 to control motor speed.
void robot.move_backward(char motor_speed)
Set the speed of both motors to move the robot backwards. char motor_speed: set to a number between 0 and 150 to control motor speed.
void robot.turn_right(char motor_speed)
Set the speed of both motors to turn the robot right. char motor_speed: set to a number between 0 and 150 to control motor speed.
void robot.turn_left(char motor_speed)
Set the speed of both motors to turn the robot left. char motor_speed: set to a number between 0 and 150 to control motor speed.
void robot.stop_movement()
Set the speed of both motors to stop their movements.
void robot.set_motor(byte motor, char motor_speed, bool forward)
Set the speed of one motor. byte motor: set to 1 or 2 to control motor 1 or motor 2; char motor_speed: set to a number between 0 and 150 to control motor speed; bool forward: set to true for forward movement, false for backward movement.
You can use combinations of this function to control any movement of the two motors.