Introducing Customized Blockly Blocks

Define Master Block

This block enables the configuration of a USB gateway and its initialization with a user-selected baud rate. The baud rate can be conveniently chosen from a drop-down menu, ensuring flexibility and ease of use. The USB gateway serves as a critical communication bridge between the computer and the SMD Red system, facilitating seamless data exchange.

Smd Red Block

This block establishes a connection to an SMD Red device by utilizing a specified Red ID parameter. The user is required to provide a valid Red ID to ensure accurate identification and communication with the target device.

Above is the block structure for connecting to the smd red device with id value 0 and baudrate value 115200.

Set CPR Block

This block is used to configure the CPR (Counts Per Revolution) value for a motor identified by a specified Red ID. The user provides the desired CPR value, which determines the resolution of the motor's encoder, ensuring precise control and measurement.

Set RPM Block

This block is used to configure the RPM (Revolutions Per Minute) value for a motor identified by a specified Red ID. The user provides the desired RPM value, which controls the motor's rotational speed to meet application-specific requirements.

Define Motor Block

This block is used to initialize and start a motor using its default parameters. To activate the motor, the user must provide the Red ID, which identifies the specific motor to be started.

Set Control Parameters Block

This block allows you to configure the PID parameters dynamically for the specific mode you choose and the Red ID you input. By specifying the appropriate mode (Velocity, Position, Torque) and a unique Red ID, you can assign tailored values for the proportional (Kp), integral (Ki), and derivative (Kd) gains. The functionality ensures flexibility and precision for different control scenarios.

Enable Torque Bloc

This block is designed to initiate the torque of an motor dynamically using a specified Red ID. By entering the appropriate Red ID, the system ensures precise activation of the torque mechanism, tailored to the corresponding motor.

Set Operation Mode Block

This block allows the user to set the operating mode for a motor identified by a specified Red ID. The user can select from one of the following modes: PWM, Position, Speed, or Torque, depending on the desired control strategy for the motor.

Pwm Mode Blocks

These two blocks perform the same function, with the distinction that one accepts only numerical values, while the other accepts a joystick variable block as input. This flexibility allows users to choose the appropriate input method based on their specific application requirements.

Position Mode Blocks

These two blocks perform the same function, but with different methods of control: one rotates the motor directly to the specified position (in degrees), while the other uses a joystick input block to control the rotation.

Velocity Mode Blocks

These two blocks perform the same function, but with different methods of speed control: one rotates the motor at a constant speed based on a given value, while the other adjusts the speed dynamically using a joystick input.

Torque Mode Blocks

These two blocks perform the same function, but with different methods for controlling the motor's current: one rotates the motor based on a fixed milliampere value, while the other adjusts the milliampere value dynamically using a joystick input.

Get Joystick Block

This block receives x, y, and button information from the joystick module and synchronizes it with the corresponding variable blocks placed on the values within the block. This allows real-time control and interaction based on joystick input.

RGB Led Block

This block controls the RGB LED module by setting its color according to the RGB values entered. Users can specify the desired red, green, and blue values to customize the LED’s color output.

Button Block

This block retrieves and returns the current value from the button module, allowing the system to react based on the button's state (e.g., pressed or released).

This block retrieves and returns the current ambient light value, allowing the system to adjust or react based on the surrounding light conditions.

This block retrieves and returns the distance value measured by the ultrasonic distance sensor, providing accurate readings of the proximity or distance to an object..

Buzzer Block

This block activates the buzzer module and sets it to emit sound at the frequency value entered by the user.

IMU Block

This block receives and processes data from the IMU (Inertial Measurement Unit), which typically includes information such as orientation.

Potentiometer Block

This block retrieves the ADC (Analog-to-Digital Conversion) value from the potentiometer module, providing a digital representation of the analog voltage output based on the potentiometer's position.

Servo Blocks

This block is used to set the position of a servo motor by specifying the desired angle. The motor adjusts its position to align with the given angle value.

QTR Block

This block retrieves the sensor values from the QTR module, typically used for detecting changes in proximity, position, or surface reflection.

Get Position Block

This block retrieves the current position of the motor identified by the specified Red ID. It allows the system to track and monitor the motor's position in real-time.

Last updated