pin1,2,3,servo
Dependencies: Servo Test2Boards LSCServo ros_lib_melodic DC_Stepper_Controller_Lib
Diff: main.cpp
- Revision:
- 2:399bcafe6f36
- Parent:
- 1:ac39b48026ca
- Child:
- 3:759af41b06ee
diff -r ac39b48026ca -r 399bcafe6f36 main.cpp --- a/main.cpp Sat Mar 13 05:26:36 2021 +0000 +++ b/main.cpp Fri Mar 26 17:03:52 2021 +0000 @@ -3,12 +3,14 @@ #include <ros.h> #include "std_msgs/Bool.h" +#include "geometry_msgs/Twist.h" #define BAUD_RATE 115200 using namespace std; using namespace std_msgs; using namespace ros; +using namespace geometry_msgs; DigitalOut myled = LED1; DigitalOut Refer_Volt_3_3 = PB_1; @@ -16,6 +18,8 @@ DigitalOut pin_B = PA_2; DigitalOut pin_C = PA_3; + + NodeHandle nh; Servo servo = D6; @@ -56,11 +60,17 @@ pin_C = 0; } +void messagekeypad (const Twist& _msg){ + float x = _msg.linear.x; + float y = _msg.linear.y; + +} + Subscriber<Bool> subsqu("button_square", &messagesqu); Subscriber<Bool> subcro("button_cross", &messagecro); Subscriber<Bool> subcir("button_circle", &messagecir); Subscriber<Bool> subtri("button_triangle", &messagetri); -Subscriber<Bool> subkeypad("button_keypad", &messagekeypad); +Subscriber<Twist> subkeypad("button_keypad", &messagekeypad); int main() { myled = 0;