// Finger number enumerationenumclassFingerNumber : uint8_t {Thumb = 0x1, // ThumbIndex = 0x2, // Index fingerMiddle = 0x3, // Middle fingerRing = 0x4, // Ring fingerLittle = 0x5, // Little finger};/** * Get the position of a specific finger. * @paramno The number of the finger (Thumb, Index, Middle, Ring, or Little). * @return The current position of the finger (0 to 100). */uint8_tgetFingerValue(FingerNumberno);/** * Set the position of a specific finger. * @paramfingerNum The number of the finger (Thumb, Index, Middle, Ring, or Little). * @paramposition The desired position of the finger (0 to 100). */voidsetFinger(FingerNumberfingerNum, uint8_tposition);/** * Set positions for all fingers simultaneously. * @parampos1 Position for finger 1 (0 to 100). * @parampos2 Position for finger 2 (0 to 100). * @parampos3 Position for finger 3 (0 to 100). * @parampos4 Position for finger 4 (0 to 100). * @parampos5 Position for finger 5 (0 to 100). */voidsetAllFinger(uint8_tpos1, uint8_tpos2, uint8_tpos3, uint8_tpos4, uint8_tpos5);// Gesture number enumerationenumclassGestureNumber : uint8_t {Reset = 0, // Reset gesturePinch = 1, // Pinch gestureGrasp = 2, // Grasp gestureSidePinch = 3, // Side pinch gestureTripod = 4, // Tripod gestureWave = 5, // Wave gestureScissors = 6, // Scissors gestureRock = 7, // Rock gesturePaper = 8// Paper gesture};/** * Set the position of a specific gesture. * @paramgestureNum The number of the gesture. * @paramposition The desired position of the gesture (0 to 100). */voidsetGesture(GestureNumbergestureNum, uint8_tposition);
enumclassCarAction : uint8_t {Forward = 1, // ForwardBackward = 2, // BackwardLeft = 3, // Left turnRight = 4// Right turn};/** * Set actions for a robotic car. * @paramcarAction The desired action for the car (Forward, Backward, Left, or Right). * @paramspeed Speed of the car (0 to 100). * @paramtime Duration of the action (0 to 255). */voidsetCar(CarActioncarAction, uint8_tspeed, uint8_ttime);// Motor number enumerationenumclassMotorNumber : uint8_t {Motor1 = 0, // Motor 1Motor2 = 1, // Motor 2MotorAll = 2// Both motors (Motor 1 + Motor 2)};/** * Set motor parameters for specific actions. * @parammotorNumber The number of the motor (Motor1, Motor2, or MotorAll). * @paramdirection Motor direction (0 for forward, 1 for backward). * @paramspeed Motor speed (0 to 100). * @paramangle Motor rotation angle (0 to 360). * @paramtime Duration of motor action (0 to 255). */voidsetMotor(MotorNumbermotorNumber, uint8_tdirection, uint8_tspeed, uint8_tangle, uint8_ttime);enumclassServoNumber : uint8_t {Servo1 = 0, // Servo 1Servo2 = 1, // Servo 2Servo3 = 2, // Servo 3Servo4 = 3, // Servo 4Servo5 = 4, // Servo 5Servo6 = 5// Servo 6, extended servo};/** * Set the angle of a specific servo. * @paramservoNumber The number of the servo (Servo1 to Servo6). * @paramangle Desired servo angle (0 to 180). */voidsetServo(ServoNumberservoNumber, uint8_tangle);
/** * Set the color of a specific LED. * @paramr Red component of the color (0 to 255). * @paramg Green component of the color (0 to 255). * @paramb Blue component of the color (0 to 255). * @paramport The interface code (InterfaceCode enumeration). */voidsetLed(uint8_tr, uint8_tg, uint8_tb, InterfaceCodeport);/** * Check if the given RGB color is in the red color range. * @paramred Red component of the color (0 to 255). * @paramgreen Green component of the color (0 to 255). * @paramblue Blue component of the color (0 to 255). * @return True if the color is in the red range, else false. */boolisRedColor(intred, intgreen, intblue);/** * Check if the given RGB color is in the green color range. * @paramred Red component of the color (0 to 255). * @paramgreen Green component of the color (0 to 255). * @paramblue Blue component of the color (0 to 255). * @return True if the color is in the green range, else false. */boolisGreenColor(intred, intgreen, intblue);/** * Check if the given RGB color is in the blue color range. * @paramred Red component of the color (0 to 255). * @paramgreen Green component of the color (0 to 255). * @paramblue Blue component of the color (0 to 255). * @return True if the color is in the blue range, else false. */boolisBlueColor(intred, intgreen, intblue);
// Enumeration of sensor typesenumclassSensorType : uint8_t {SoftSmall = 1, // Small soft sensorHall = 2, // Hall sensorRGB = 3, // RGB sensorInfrared = 4, // Infrared sensorUltrasonic = 5, // Ultrasonic sensorTemperature = 6, // Temperature sensorSound = 7, // Sound sensorEMG = 8, // EMG signal sensorLED = 9, // LED controlPotentiometer = 10, // Potentiometer sensorButton = 11, // Button sensorSoftBig = 12// Large soft sensor};// Enumeration of interface codesenumclassInterfaceCode : uint8_t {A = 0, // Interface AB = 1, // Interface BC = 2, // Interface CD = 3, // Interface DE = 4, // Interface EF = 5// Interface F, advanced interface};/** * Check if a specific sensor is ready for reading in specific interface. * @paramsensorType The type of sensor (SensorType enumeration). * @paraminterface The interface code (InterfaceCode enumeration). * @return True if the sensor is ready, otherwise false. */boolisSensorReady(SensorTypesensorType, InterfaceCodeinterface);/** * Check if a specific sensor is turned on in specific interface. * @paramsensorType The type of sensor (SensorType enumeration). * Valid sensor types: Hall, Infrared, Sound, Button. * @paraminterface The interface code (InterfaceCode enumeration). * @return True if the sensor is turned on, otherwise false. */boolisSensorOn(SensorTypesensorType, InterfaceCodeinterface);/** * Get a 16-bit integer value from a specific sensor in specific interface. * @paramsensorType The type of sensor (SensorType enumeration). * Valid sensor types: SoftSmall, Ultrasonic, Temperature, Voltage, EMG. * @paraminterface The interface code (InterfaceCode enumeration). * @return The 16-bit integer value read from the sensor. * For Ultrasonic: [0-1000] (0.1cm) * For Temperature: [-200-1000] (0.1℃) * For other sensor types, the actual range depends on the sensor. */int16_tgetSensorInt16(SensorTypesensorType, InterfaceCodeinterface);/** * Get the value of a specific RGB component from color sensor in specific interface. * @paraminterface The interface code (InterfaceCode enumeration). * @paramindex The index of the RGB component (0 for Red, 1 for Green, 2 for Blue). * @return The RGB component value (0 to 255). */uint8_tgetRgbValue(InterfaceCodeinterface, uint8_tindex);/** * Get an array of RGB component values from color sensor in specific interface. * @paraminterface The interface code (InterfaceCode enumeration). * @return Pointer to the array of RGB component values (Red, Green, Blue). */uint8_t*getRgbValues(InterfaceCodeinterface);/** * Get the value of a specific index from the large soft sensor. * @paramno The index of the value to retrieve (1 to 5). * @return The value at the specified index from the large soft sensor. * Returns 0 if the index is out of range or if sensor data retrieval fails. */uint8_tgetSoftBig(intno);
/** * Enumeration of GPIO levels. */enumclassGPIOLevel : uint8_t {Low = 0x00, // Low output levelHigh = 0x01, // High output level};/** * Set the GPIO level for a specific GPIO pin. * @paramgpioNumber The GPIO pin number [1-15]. * @paramlevel The desired GPIO level (GPIOLevel enumeration). */voidsetGPIO(uint8_tgpioNumber, GPIOLevellevel);/** * Get the current state of a digital GPIO pin. * @paramno The GPIO pin number [1-15]. * @return True if the GPIO pin is in a high state, false if it's in a low state. */boolisGpioHigh(uint8_tno);/** * Get the analog value from a specific analog input pin. * @paramno The analog input pin number [1-10]. * @return The analog value read from the input pin [0-4095]. */uint16_tgetAioValue(uint8_tno);