Blink.cpp
Go to the documentation of this file.
1 /*
2  * rosserial Subscriber Example
3  * Blinks an LED on callback
4  */
5 #include "mbed.h"
6 #include <ros.h>
7 #include <std_msgs/Empty.h>
8 
10 DigitalOut myled(LED1);
11 
12 void messageCb(const std_msgs::Empty& toggle_msg){
13  myled = !myled; // blink the led
14 }
15 
17 
18 int main() {
19  nh.initNode();
20  nh.subscribe(sub);
21 
22  while (1) {
23  nh.spinOnce();
24  wait_ms(1);
25  }
26 }
27 
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())


rosserial_mbed
Author(s): Gary Servin
autogenerated on Mon Jun 10 2019 14:53:26