изменила форматирование. Добавила автовыбор ножек в зависимости от выбранной платы
This commit is contained in:
1 parent
78ef98a74d
commit
f3df27f5fc
12 files changed
+261
-268
No files matched your search
@@ -8,31 +8,36 @@ TaskHandle_t TaskSerial_Handler;
|
||||
void TaskBlink( void *pvParameters );
|
||||
void TaskSerial(void* pvParameters);
|
||||
|
||||
// set led pin
|
||||
#ifdef LED_BUILTIN
|
||||
uint8_t blink_pin = LED_BUILTIN;
|
||||
#elif defined(ARDUINO_ELSOMIK)
|
||||
uint8_t blink_pin = P0_0;
|
||||
#else
|
||||
uint8_t blink_pin = 2;
|
||||
#endif
|
||||
|
||||
// the setup function runs once when you press reset or power the board
|
||||
void setup() {
|
||||
// initialize serial communication at 9600 bits per second:
|
||||
Serial.begin(9600);
|
||||
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for native USB, on LEONARDO, MICRO, YUN, and other 32u4 based boards.
|
||||
}
|
||||
|
||||
// Now set up two tasks to run independently.
|
||||
xTaskCreate(
|
||||
TaskBlink
|
||||
, "Blink" // A name just for humans
|
||||
, 128 // This stack size can be checked & adjusted by reading the Stack Highwater
|
||||
, NULL //Parameters passed to the task function
|
||||
, 2 // Priority, with 2 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
|
||||
, &TaskBlink_Handler );//Task handle
|
||||
TaskBlink,
|
||||
"Blink", // A name just for humans
|
||||
128, // This stack size can be checked & adjusted by reading the Stack Highwater
|
||||
NULL, // Parameters passed to the task function
|
||||
2, // Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.
|
||||
&TaskBlink_Handler); // Task handle
|
||||
|
||||
xTaskCreate(
|
||||
TaskSerial
|
||||
, "Serial"
|
||||
, 128 // Stack size
|
||||
, NULL //Parameters passed to the task function
|
||||
, 1 // Priority
|
||||
, &TaskSerial_Handler ); //Task handle
|
||||
TaskSerial,
|
||||
"Serial",
|
||||
128, // Stack size
|
||||
NULL, // Parameters passed to the task function
|
||||
1, // Priority
|
||||
&TaskSerial_Handler); // Task handle
|
||||
}
|
||||
|
||||
|
||||
@@ -73,13 +78,12 @@ void TaskSerial(void* pvParameters){
|
||||
void TaskBlink(void *pvParameters) // This is a task.
|
||||
{
|
||||
(void) pvParameters;
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
pinMode(blink_pin, OUTPUT);
|
||||
for (;;) // A Task shall never return or exit.
|
||||
{
|
||||
//Serial.println(11);
|
||||
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||
vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second
|
||||
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
|
||||
vTaskDelay( 1000 / portTICK_PERIOD_MS ); // wait for one second
|
||||
digitalWrite(blink_pin, HIGH); // turn the pin on (HIGH is the voltage level)
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS); // wait for one second
|
||||
digitalWrite(blink_pin, LOW); // turn the pin off by making the voltage LOW
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS); // wait for one second
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user