-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStepper-Driver.ino
78 lines (65 loc) · 2.86 KB
/
Stepper-Driver.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <Arduino.h>
#include "WiFi.h"
#include "Controller.h"
#include <SPI.h>
extern void taskApp(void* parameter);
extern void taskCan(void* parameter);
const char *ssid = "TP-LINK_DC0B"; //wifi
const char *password = "123qwe456asd";
void taskWiFi(void* parameter){
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
while(1){
vTaskDelay(1000);
if ((WiFi.status() != WL_CONNECTED)) {
WiFi.disconnect();
WiFi.reconnect();
//Serial.printf("wifi status: WL_DISCONNECTED \n");
}//else Serial.println(WiFi.localIP());
}
}
void setup() {
Serial.begin(115200);
delay(100);
xTaskCreatePinnedToCore(taskWiFi, /* Task function. */
"taskWiFi", /* String with name of task. */
3000, /* Stack size in bytes. */
NULL, /* Parameter passed as input of the task */
2, /* Priority of the task. */
NULL, 0); /* Task handle. */
xTaskCreatePinnedToCore(taskApp, /* Task function. */
"taskApp", /* String with name of task. */
10000, /* Stack size in bytes. */
NULL, /* Parameter passed as input of the task */
1, /* Priority of the task. */
NULL, 0); /* Task handle. */
xTaskCreatePinnedToCore(taskCan, /* Task function. */
"taskCan", /* String with name of task. */
3000, /* Stack size in bytes. */
NULL, /* Parameter passed as input of the task */
3, /* Priority of the task. */
NULL, 0); /* Task handle. */
xTaskCreatePinnedToCore(taskRun, /* Task function. */
"taskRun", /* String with name of task. */
10000, /* Stack size in bytes. */
NULL, /* Parameter passed as input of the task */
1, /* Priority of the task. */
NULL, 1); /* Task handle. */
xTaskCreatePinnedToCore(taskController, /* Task function. */
"taskController", /* String with name of task. */
10000, /* Stack size in bytes. */
NULL, /* Parameter passed as input of the task */
2, /* Priority of the task. */
NULL, 1); /* Task handle. */
}
void loop() { // run over and over again
}