Czy komukolwiek udało się odpalić licznik impulsów na ESP32?
Spróbowałem wgrać przykład:
Code: Select all
/*
Copyright (C) AC SOFTWARE SP. Z O.O.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <SPI.h>
#include <SuplaDevice.h>
#include <supla/sensor/impulse_counter.h>
// Choose where Supla should store counter data in persistant memory
// We recommend to use external FRAM memory
#define STORAGE_OFFSET 100
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom(STORAGE_OFFSET);
// #include <supla/storage/fram_spi.h>
// Supla::FramSpi fram(STORAGE_OFFSET);
// Choose proper network interface for your card:
// ESP32 based board:
#include <supla/network/esp32_wifi.h>
Supla::ESP32Wifi wifi("xxxxx", "xxxxx");
void setup() {
Serial.begin(115200);
// Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
char GUID[SUPLA_GUID_SIZE] = {0x9B,0xA1,0x43,0xE7,0x34,0x1A,0x87,0xF1,0xCF,0x3C,0xE6,0x0B,0x19,0xCA,0x17,0x0E};
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x3C,0xEC,0x4C,0xDB,0xCC,0xBF,0xFF,0x2F,0xA3,0x5E,0x14,0x79,0x98,0x79,0x4E,0xFE};
/*
* Having your device already registered at cloud.supla.org,
* you want to change CHANNEL sequence or remove any of them,
* then you must also remove the device itself from cloud.supla.org.
* Otherwise you will get "Channel conflict!" error.
*/
// CHANNEL0 - Impulse Counter on pin 34, counting raising edge (from LOW to HIGH), no pullup on pin, and 10 ms debounce timeout
new Supla::Sensor::ImpulseCounter(12, true, false, 10);
// CHANNEL1 - Impulse Counter on pin 35, counting falling edge (from HIGH to LOW), with pullup on pin, and 50 ms debounce timeout
new Supla::Sensor::ImpulseCounter(13, false, true, 50);
/*
* Server address is available at https://cloud.supla.org
* If you do not have an account, you can create it at https://cloud.supla.org/account/create
* SUPLA and SUPLA CLOUD are free of charge
*/
SuplaDevice.setName("A Impuls Couter");
SuplaDevice.begin(GUID, // Global Unique Identifier
"xxxxx", // SUPLA server address
"xxxxx", // Email address used to login to Supla Cloud
AUTHKEY); // Authorization key
}
void loop() {
SuplaDevice.iterate();
}
Podawał na piny stan niski (GND) i wysoki 3.3V i żadnego efektu.