arduino-sketches – Diff between revs 15 and 22

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 15 Rev 22
Line 60... Line 60...
60 // Define GPIO pins for supported architectures. 60 // Define GPIO pins for supported architectures.
61 #if defined(ARDUINO_ARCH_ESP8266) 61 #if defined(ARDUINO_ARCH_ESP8266)
62 int PINS[] = { D0, D1, D2, D3, D4, D5, D6, D7, D8 }; 62 int PINS[] = { D0, D1, D2, D3, D4, D5, D6, D7, D8 };
63 int ANAL[] = { A0 }; 63 int ANAL[] = { A0 };
64 #elif defined(ARDUINO_ARCH_ESP32) 64 #elif defined(ARDUINO_ARCH_ESP32)
-   65 int PINS[] = {
65 int PINS[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 66 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
66 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 67 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
67 22, 23, 24, 25, 26, 27, 28, 19, 30, 31, 68 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
68 32, 33, 34, 35, 36, 37, 38, 39 }; 69 31, 32, 33, 34, 35, 36, 37, 38, 39
-   70 };
-   71 int ANAL[] = {
69 int ANAL[] = { 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 72 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0,
70 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 73 0, 12, 13, 14, 15, 0, 0, 0, 0, 0,
71 0, 0, 0, 25, 26, 27, 0, 0, 0, 0, 74 0, 0, 0, 0, 25, 26, 27, 0, 0, 0,
72 32, 33, 34, 35, 36, 0, 0, 39 }; 75 0, 32, 33, 34, 35, 36, 0, 0, 39
-   76 };
73 #endif 77 #endif
Line 74... Line 78...
74 78
75 String mqttSerialize(StaticJsonDocument<256> msg) { 79 String mqttSerialize(StaticJsonDocument<256> msg) {
76 char output[256]; 80 char output[256];
Line 146... Line 150...
146 150
147 mqttClient.publish(MQTT_TOPIC().c_str(), mqttSerialize(msg).c_str()); 151 mqttClient.publish(MQTT_TOPIC().c_str(), mqttSerialize(msg).c_str());
148 return; 152 return;
Line -... Line 153...
-   153 }
-   154  
-   155 if(action == "push") {
-   156 const int pin = (const int)doc["pin"];
-   157 int time = (const int)doc["delay"];
-   158 if(time <= 0) {
-   159 time = 75;
-   160 }
-   161
-   162 Serial.println("Pushing pin: " + String(pin) + " with intermediate delay: " + String(time));
-   163
-   164 pinMode(PINS[pin], OUTPUT);
-   165 digitalWrite(PINS[pin], HIGH);
-   166 delay(time);
-   167 digitalWrite(PINS[pin], LOW);
-   168  
-   169 return;
149 } 170 }
150   171  
Line 151... Line 172...
151 if(action == "measure") { 172 if(action == "measure") {
152 const int pin = (const int)doc["pin"]; 173 const int pin = (const int)doc["pin"];