]> Zhao Yanbai Git Server - acecode.git/commitdiff
...
authorAceVest <zhaoyanbai@126.com>
Mon, 18 Jun 2018 09:33:47 +0000 (17:33 +0800)
committerAceVest <zhaoyanbai@126.com>
Mon, 18 Jun 2018 09:33:47 +0000 (17:33 +0800)
arduino/hardware/ace/avr/cores/avr/app.cpp

index ab21c2995328b3e622ebd8b93d915d45fe4b9afb..0b517b92b40260f02831198f8d89cf9a97870e3c 100644 (file)
@@ -42,10 +42,16 @@ void user_task1() {
 uint8_t user_task2_stack[TASK_STACK_SIZE];
 void user_task2() {
     int cnt = 0;
+    uint8_t pin = 14;
+    set_digital_pin_mode(pin, OUTPUT);
+    uint8_t state = LOW;
+
     while(1) {
+        state = state == LOW ? HIGH : LOW;
+        digital_write(pin, state);
         Serial.print("user task 2, cnt: ");
         Serial.println(cnt++);
-        task_delay(90);
+        task_delay(random() % 50);
     }
 }
 #endif