Skip to content

Commit

Permalink
サンプルコードを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
sarukiti committed Apr 15, 2023
1 parent d76b14e commit 6c9fe97
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
21 changes: 21 additions & 0 deletions sample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.16.3)
project(motor_sample CXX)

find_package(usb_connect REQUIRED)
find_package(motor_lib REQUIRED)

include_directories(
include
)

add_executable(md_sample src/md_sample.cpp)

target_link_libraries(md_sample
usb_connect
motor_lib
md_lib
sd_lib
smd_lib
sm_lib
sr_lib
)
17 changes: 17 additions & 0 deletions sample/src/md_sample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <usb_connect/usb_connect.hpp>
#include <motor_lib/motor_lib.hpp>
#include <unistd.h>

int main(void){
MotorLib::usb_config.vendor_id = 0x483;
MotorLib::usb_config.product_id = 0x5740;
MotorLib::usb_config.b_interface_number = 0;

MotorLib::usb.setUsb(&MotorLib::usb_config);
MotorLib::usb.openUsb();

MotorLib::md.sendPwm(0x00, NULL, 0, 999, 1000);
sleep(2);
MotorLib::stopAll();
MotorLib::usb.closeUsb();
}

0 comments on commit 6c9fe97

Please sign in to comment.