VBCores Docs
HomeGitHub
  • VBCores
  • Hardware
    • VBCore VB32G4
    • VB STM32 Programmer
    • BLDC motor driver 30A
    • DC motor driver 15A
    • Stepper motor driver 10A
    • Ethernet - CAN-FD
    • CAN-FD - Raspberry PI
      • Setting up CAN on Raspberry Pi
      • Troubleshooting
      • Работа с CAN FD через Python
    • PowerBoard 30A
    • SBus-HID
    • DC-DC 12V
    • USB 2.0-HUB
    • IMU BNO055
    • IMU BHI360
    • T-encoder
  • Software
    • Arduino IDE
      • Arduino IDE setup
      • Selecting MCU
      • Optional hardware preparation
      • Prepairing a sketch
      • Libraries
      • Examples
        • Все переписать нахрен
        • Работа с I2C
        • I2C detect
        • Датчик BNO055 / I2C
        • Датчик AS5047P / SPI
        • Датчик AS5600 / I2C
        • Работа с бесколлекторными двигателями
          • Simple FOC. Управление скоростью. Нахождение количества пар полюсов.
          • Simple FOC. Управление моментом
          • Чтение данных с датчика тока
        • Работа с коллекторным двигателем
          • Вращение DC мотором
          • Чтение угла по энкодеру. Управление DC мотором по углу
          • Чтение скорости вращения мотора по энкодеру
        • Работа с шаговым двигателем
          • Вращение шагового двигателя.
          • Контроль двигателя по интерфейсу SPI
    • STM32 CUBE IDE
      • Типовые настройки
      • Подсказки начинающим
        • Cube IDE для начинающих
        • Clock configuration
        • Таймеры - прерывания
        • Таймеры - ШИМ
        • Отладка программ
        • Коммуникации - FDCAN
        • Управление DC-мотором
        • Backup программы
  • Cyphal CAN
    • Cyphal CAN
    • PyCyphal
    • Yakut
    • Cyphal Arduino
      • Отправка и получение сообщений по cyphal
  • Работа с ROS
    • Установка Ubuntu, ROS и Arduino
    • ROS_LIB
    • Возможные ошибки
    • Примеры
      • Publisher. Hello World!
      • Publisher with Subscriber
      • Rotation by DC motor
  • Example projects
    • Motor-wheel upgrade
Powered by GitBook
On this page
  1. Software
  2. Arduino IDE

Prepairing a sketch

Last updated 13 days ago

Finally, we are ready to write programs! Just kidding, there is another configuration step.

After a reset, any microcontroller goes through an initialization process during which the clock, peripherals, and other things are configured. In the Arduino world, these steps are usually hidden from the user. Our board is no exception, as we have created a small library that applies the basic settings.

It's called and is mandatory for proper operation. Download and place it into the Arduino's libraries folder. Usually this folder is located at C:\Program Files (x86)\Arduino\libraries or C:\Users\username\Documents\Arduino\libraries.

The following line enables this library for your sketch:

#include <VBCoreG4_arduino_system.h>

PD2 and PA5 pins are named as LED1 and LED2. PC13 named as USR_BTN.

To check that everything is set up correctly, download, build and run the following sketch.

More examples for VB32G4 and VBCore motor driver boards are in our .

BLDC motor control requires library. The complete manual is available by the link.

In case you're working with the popular AS5047 sensor we recommend using our modified .

VBCoreG4_arduino_system
repo
SimpleFOC
library
790B
blink.ino