File tree Expand file tree Collapse file tree 3 files changed +5
-15
lines changed
examples/micro-ros_publisher Expand file tree Collapse file tree 3 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,9 @@ rcl_timer_t timer;
24
24
25
25
void error_loop (){
26
26
while (1 ){
27
- digitalWrite (LED_PIN, !digitalRead (LED_PIN));
28
- delay (100 );
27
+ // digitalWrite(LED_PIN, !digitalRead(LED_PIN));
28
+ delay (300 );
29
+ SerialUSB.println (" Error" );
29
30
}
30
31
}
31
32
@@ -82,6 +83,5 @@ void setup() {
82
83
}
83
84
84
85
void loop () {
85
- delay (100 );
86
86
RCCHECK (rclc_executor_spin_some (&executor, RCL_MS_TO_NS (100 )));
87
87
}
Original file line number Diff line number Diff line change @@ -44,17 +44,7 @@ extern "C"
44
44
// Place here your reading bytes platform code
45
45
// Return number of bytes read (max bytes: len)
46
46
(void )errcode;
47
- uint32_t start_time = micros () * 1000 ;
48
- size_t readed = 0 ;
49
-
50
- while ((readed < len) && ((micros () * 1000 ) - start_time) < (uint32_t )timeout)
51
- {
52
- if (SerialUSB.available ())
53
- {
54
- buf[readed++] = SerialUSB.read ();
55
- }
56
- }
57
-
58
- return readed;
47
+ SerialUSB.setTimeout (timeout);
48
+ return SerialUSB.readBytes ((char *)buf, len);
59
49
}
60
50
}
You can’t perform that action at this time.
0 commit comments