# Примеры Arduino

Перед вами примеры программ для работы с различными датчиками, моторами, интерфейсами передачи данных.  Все примеры вы можете найти на [https://github.com/VBCores/VBCoreG4\_examples/](https://github.com/VBCores/VBCoreG4_examples/tree/main)

{% hint style="info" %}
Чтобы работать с **CYPHAL CAN**, скачайте библиотеку [libcypcal](https://github.com/VBCores/libcxxcanard) и скопируйте в свою папку **Arduino/Libraries**. **Документация с примерами к этой библиотеке есть в** [**libcyphal-docs**](https://github.com/VBCores/libcyphal-docs/tree/master). Перед написанием примера с cyphal настоятельно рекомендуем прочитать документацию к [регламентированным типам данных](https://github.com/OpenCyphal/public_regulated_data_types/tree/master) . Это существенно облегчит вам понимание особенностей типов и их адресации
{% endhint %}

{% hint style="info" %}
Чтобы **корректно повторить примеры и настроить пины,** рекомендуется заранее прочитать pinout и документацию для каждого используемого драйвера и модуля.
{% endhint %}

<table><thead><tr><th width="374">Repository</th><th>Description</th></tr></thead><tbody><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic"><mark style="color:$info;background-color:$info;"><strong>BASIC:</strong></mark></a></td><td><strong>Простейшие примеры программ взаимодействия VBCore с переферией</strong></td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/blink">Blink</a></td><td>Мигание светодиодом</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/DAC_example">DAC_example</a></td><td>Пример работы с ЦАП (преобразование дискретных цифровых данных в непрерывный аналоговый сигнал)</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/btn_to_serial">BTN_with_Serial</a></td><td>Пример работы с пользовательской кнопкой и сериал портом</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/simple_timer">Timer_example</a></td><td>Пример работы с таймером</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/btn_serial_timer_blink">Timer_with_Serial_and_BTN</a></td><td>Мигание светодиодом с частотой, заданной через сериал порт</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/STM32Duino_I2C_scanner">I2C_scanner</a></td><td>Обнаружение устройств, подключенных к шине I2C</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/bno_example">BNO_example</a></td><td>Пример чтения инерциального датчика BNO по I2C</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/AS5047P_ReadAngle">AS5047P_SPI_example</a></td><td>Пример чтения датчика AS5047P по SPI</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/AS5600_read_magnet">AS5600_I2C_example</a></td><td>Пример чтения датчика AS5600 по I2C</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/dip_switch_reading">DIP_Switch_Reading</a></td><td>Пример работы с DIP переключателем</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/eeprom_example_basic">EEPROM_Basic</a></td><td>Пример работы с EEPROM</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/basic/eeprom_with_VBEEPROM">VB_EEPROM_example</a></td><td>Работа с EEPROM с использованием готовых функций, собранных в библиотеке VB_EEPROM</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/can"><mark style="color:$info;"><strong>CAN</strong></mark></a></td><td><strong>Примеры программ для работы с CAN CAN FD и Cyphal CAN</strong></td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/can/can_classic">Classic_CAN</a></td><td>Передача и получение данных по CAN</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/can/can_fd">CAN_FD</a></td><td>Передача и получение данных по CAN FD</td></tr><tr><td><a href="https://github.com/VBCores/libcxxcanard-docs/tree/master/examples/arduino/angle">Cyphal_send_angle</a></td><td>Отправка угла по cyphal can</td></tr><tr><td><a href="https://github.com/VBCores/libcxxcanard-docs/tree/master/examples/arduino/array">Cyphal_send_array</a></td><td>Отправка массива чисел по cyphal can</td></tr><tr><td><a href="https://github.com/VBCores/libcxxcanard-docs/tree/master/examples/arduino/heartbeat">Cyphal_send_heartbeat</a></td><td>Отправка сообщения типа heartbeat по cyphal can</td></tr><tr><td><a href="https://github.com/VBCores/libcxxcanard-docs/tree/master/examples/arduino/string">Cyphal_send_string</a></td><td>Отправка строковой переменной по cyphal can</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/can/cyphal_can_send">Cyphal_send_<em>angular_</em>vel_and_angle</a></td><td>Отправка двух сообщений - угловой скорости и угла по cyphal can</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/can/cyphal_can_recv">Cyphal_recv_<em>angular_vel</em></a></td><td>Получение сообщения (угловая скорость) по cyphal can</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/python"><mark style="color:$info;"><strong>Python_Programm</strong></mark></a></td><td><strong>Программы верхнего уровня, написанные на Python</strong></td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/blob/main/examples/python/can_recv.py">CAN_Recv</a></td><td>Получение сообщения по CAN в программе на Python</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/blob/main/examples/python/can_send.py">CAN_Send</a></td><td>Отправка сообщения по CAN в программе на Python</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc"><mark style="color:$info;"><strong>DC_Driver</strong></mark></a></td><td><strong>Программы для работы с dc драйвером и dc моторами</strong></td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc/pwm">PWM</a></td><td>Управление ШИМ сигналом для вращения DC мотора</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc/pwm_encoder_read">EncoderAB_Read</a></td><td>Чтение инекрементального AB енкодера DC мотора</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc/read_encoder_ABZ">EncoderABZ_Read</a></td><td>Чтение инекрементального ABZ енкодера DC мотора</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc/move_pos_motor">Pos_control</a></td><td>Управление мотором по позиции</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc/read_velocity_dc_motor">Get_velocity</a></td><td>Чтение скорости мотора по енкодеру</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc/angle_vel_from_encoder">Get_ang_vel_from_encoder</a></td><td>Чтение скорости и угла положения вала мотора по енкодеру</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/dc/read_angle_from_encoder_ABZ">Get_ang_from_encoderABZ</a></td><td>Чтение скорости и угла положения вала мотора по ABZ енкодеру</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/bldc"><mark style="color:$info;"><strong>BLDC_DRIVER</strong></mark></a></td><td><strong>Программы для работы с bldc драйвером и bldc моторами</strong></td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/bldc/SimpleFoc">Find_numper_of_pole_pairs</a></td><td>Нахождение количества пар полюсов bldc мотора</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/bldc/SimpleFoc/velocity_control_with_current">Velocity_control</a></td><td>Управление мотором по скорости</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/bldc/SimpleFoc/motor_torque_control">Torque_voltage_control</a></td><td>Управление мотором по моменту (используя напряжение)</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/stepper"><mark style="color:$info;"><strong>STEPPER DRIVER</strong></mark></a></td><td><strong>Программы для работы с  драйвером шагового двигателя</strong></td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/blob/main/examples/stepper/spi_example/spi_example.ino">Control_by_SPI</a></td><td>Управление шаговым двигателем по интерфейсу SPI</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/stepper/tmc_lib_example">Control_by_tmcLib</a></td><td>Управление шаговым двигателем, используя ардуиновскую библиотеку TMCStepper</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/other"><mark style="color:$info;"><strong>OTHER_EXAMPLES</strong></mark></a></td><td><strong>Примеры программ совместного использования модуля и драйверов моторов с can/cyphal</strong></td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/other/can_fd_dc_pwm">CanFD_with_dc_motor_ctrl</a></td><td>Вращение dc мотором, управление передается по CAN FD</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/other/cyphal_dc">Cyphal_with_dc_motor_ctrl</a></td><td>Вращение dc мотором, управление передается по Cyphal can</td></tr><tr><td><a href="https://github.com/VBCores/VBCoreG4_examples/tree/main/examples/other/cyphal_velocity_control_bldc">Cyphal_with_bldc_velocity_control</a></td><td>Вращение bldc мотором, управление (целевая скорость) передается по Cyphal can</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://voltbro.gitbook.io/vbcores/primery/primery-arduino.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
