All generations.

generate functionMon, 10 Apr 2023

funcion de Arduino IDE para ESP32S3 que manda un mqtt por SIM7080G usando las librerias tinyGSm y PubSubClient requiere el topic y el mensaje setup y funciones omite lineas en blanco

#include <PubSubClient.h> #include <TinyGsmClient.h> #include <TinyGsmClientSIM7080G.h> #include "secrets.h" #define LED_BUILTIN 2 // Your GPRS credentials // Leave empty, if missing user or pass const char apn[] = APN; const char user[] = USER; const char pass[] = PASS; // Poner los datos para conectarse al mqtt const char* mqtt_server = SERVER; const char* mqtt_user = USER_MQTT; const char* mqtt_pass = PASS_MQTT; #define TINY_GSM_DEBUG Serial TinyGsm modem(Serial1); TinyGsmClient client(modem); PubSubClient mqtt(client); // Está funcion se ejecuta si se hace un ping al servidor void callback(char* topic, byte* payload, unsigned int length) {

C++
View
generate functionMon, 10 Apr 2023

funcion de Arduino IDE para ESP32S3 que manda un mqtt por SIM7080G usando las librerias tinyGSm y PubSubClient requiere el topic y el mensaje setup y funciones

#include <SIM7080G.h> #include "PubSubClient.h" #include "TinyGsmClient.h" #define DEBUG true /* * Define your module's pins * (hardware serial port must be used) */ #define MODEM_RST 5 #define MODEM_PWKEY 4 #define MODEM_POWER_ON -1 #define MODEM_TX 23 #define MODEM_RX 19 #define MODEM_BAUD 9600 /* * Define your APN data */ #define APN "apn" #define USERNAME "" #define PASSWORD "" /* * Define the hostname and port */ #define HOSTNAME "test.mosquitto.org" #define HOSTPORT 1883 /* * Define MQTT topics */ #define MQTT_TOPIC "sim7080g/telemetry" #define MQTT_TOPIC_SUBSCRIBE "sim7080g/control"

C++
View
generate functionMon, 10 Apr 2023

funcion de Arduino IDE para ESP32S3 que manda un mqtt por SIM7080G usando las librerias tinyGSm y PubSubClient requiere el topic y el mensaje setup y funciones

#include <PubSubClient.h> #include <Arduino.h> #include <TinyGsmClient.h> #define MODEM_RST -1 #define MODEM_PWKEY 5 #define MODEM_POWER_ON 4 #define MODEM_TX 23 #define MODEM_RX 22 #define MODEM_BAUD 9600 #define APN "internet.itelcel.com" #define USERNAME "" #define PASSWORD "" #define TOPIC "Topic" #define PAYLOAD "Hola" //conectividad TinyGsm modem(Serial2); TinyGsmClient client(modem); PubSubClient mqtt(client); char mqttServer[] = "mqtt.thingspeak.com"; char mqttPort[] = "1883"; void setup() { // put your setup code here, to run once: pinMode(MODEM_PW

C++
View
generate functionMon, 10 Apr 2023

funcion de Arduino IDE que manda un mqtt por SIM7080G usando las librerias tinyGSm y PubSubClient requiere el topic y el mensaje setup y funciones

#include <Arduino.h> #include <TinyGsmClient.h> #include <PubSubClient.h> #include <ArduinoJson.h> #define pwmmoter 5 #define C_SPEED MOTOR_100_PERCENT #define DEVICE_NAME "test" #define AT_COMMAND_DELAY 1000 #define PUB_TOPIC "test" #define PUB_TOPIC "test" #define MQTT_SERVER "mqtt.thingspeak.com" #define MQTT_PORT 1883 TinyGsm modem(SerialAT); TinyGsmClient client(modem); PubSubClient mqtt(client); void motor_stop() { analogWrite(pwmmoter, 0); } void motor_move(int speed) { analogWrite(pwmmoter, speed); } void motor_foward() { motor_move(C_SPEED); } void

C++
View
generate functionMon, 10 Apr 2023

funcion de Arduino IDE para ESP32S3 que manda un mqtt por SIM7080G usando las librerias tinyGSm y PubSubClient requiere el topic y el mensaje setup y funciones omite lineas en blanco

#include "PubSubClient.h" #include "TinyGsmClient.h" #include <WiFi.h> #include <WiFiClient.h> #define SERVER "mqtt.thingspeak.com" #define SERVERPORT 1883 #define user "subscribe" #define pass "subscribe" #define TOPIC "channels/1037994/publish/E6ZMPK6QXCKGJU6E" # define USERAGENT "Arduino" #define PIN_TXD 15 #define PIN_RXD 16 #define PIN_RST 26 #define PIN_RTS 25 #define PIN_CTS 27 #define PIN_DCD 33 #define PIN_DSR 32 #define PIN_DTR 14 #define PIN_RI 12 #define PIN_PWR 13 unsigned long lastMillis = 0; unsigned long currentMillis = 0; WiFiClient net; TinyGsm modem(Serial1);

C++
View
generate functionMon, 10 Apr 2023

funcion de Arduino IDE que manda un mqtt por SIM7080G requeire el topic y el mensaje

#include <Arduino.h> #include <SIM7080G.h> #include <WiFi.h> //Include the Wi-Fi library #include <PubSubClient.h> #include <string.h> char ssid[] = "my_wifi_name"; char pass[] = "my_wifi_pass"; char server[] = "mqtt.thingspeak.com"; char topic[] = "channels/948297/publish/"; char clientID[] = "clientID"; char key[] = "A1DG0I9XWENHRXJL"; char mensaje[] = "field1=10&field2=20"; WiFiClient espClient; PubSubClient client(espClient); #define PIN_SIM_PWR_ON 34 #define PIN_SIM_RESET 35 #define PIN_SOCKET_TX 27 #define PIN_SOCKET_RX 26

C++
View
generate functionMon, 10 Apr 2023

funcion de Arduino IDE para ESP32S3 que manda un mqtt por SIM7080G usando las librerias tinyGSm y PubSubClient requiere el topic y el mensaje setup y funciones

const char* ssid = "MiRed"; const char* password = "miPassword"; //NEO-M8N const char* server = "your_server_ip"; const int serverPort = 8883; //SIM7080G const char* apn = "miAPN"; const char* user = "miUser"; const char* pass = "miPass"; //SIM7080G SIMCOM sim(Serial1); TinyGsmClient client(sim); PubSubClient mqtt(client); //NEO-M8N //GPS GPS gps; //NEO-M8N //GPS void setupGPS(){ gps.begin(9600); } //NEO-M8N //GPS float getLat(){ return gps.getLat(); } //NEO-M8N //GPS float getLng(){ return gps.getLng(); } //SIM7080G

C++
View

Want to kickstart your project?Use the new AI Studio to create your code