Hallo, hat jemand von den Profis einen Tipp an welchen Stellen im Sketch vom ZOEDisplay das Senden an Blynk erfolgen muss ohne die Grundfunktion des ZOE-Displays zu stören? Irgendwie komme ich mit den PID-Buffern, Interrupts oder der Seriellen in Konflikt?!
Aktueller Stand: Das Aufspielen des ZOEDisplay-Sketch auf den Arduino Mega 2560 hat super funktioniert, so als wäre ein Arduino Uno dran, nur dass SDA(D20) und SCL(D21) für das i2c Display verwendet werden und das SIM900-Shield TXD auf D50 und RXD auf D51 verkabelt wurden und so die Daten an Blynk sendet.
Dieser Link war mir bei dem Aufbau vom SIM900-Shield eine Hilfe:
https://randomnerdtutorials.com/sim900- ... d-arduino/
Nachfolgender Sketch sendet über das SIM900-Shield testweise schon Daten (Push) an meine Blynk-App, diesen hätte ich nun gerne erfolgreich in das ZOEDisplay integriert, bzw. in weiterer Folge mit SOC, Ladeleistung und Temperatur versorgt.
Code: Alles auswählen
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM900
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[] = "webaut"; //HOT
char user[] = "";
char pass[] = "";
// Hardware Serial on Mega, Leonardo, Micro
//#define SIM900 Serial1
/*
Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
Not all pins on the Leonardo and Micro support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
*/
// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
//SoftwareSerial SerialAT(7, 8); // RX, TX (Jumper Platine D7TX D8RX) 7/8 GPRS Shield
SoftwareSerial SIM900(50, 51); // RX, TX (MEGA 2560 Platine verkabelt TXD->D50, RXD->D51
TinyGsm modem(SIM900);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin's.
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
WidgetLCD wlcd(V4);
Blynk.virtualWrite(V5, millis() / 500);
Blynk.virtualWrite(V6, millis() / 1000);
Blynk.virtualWrite(V7, 77);
wlcd.clear(); //Use it to clear the LCD Widget
wlcd.print(3, 0, "Daten von:"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
wlcd.print(6, 1, "ZOE");
}
void setup()
{
pinMode(9,OUTPUT); //Autostart SIM900-Shield
digitalWrite(9, HIGH);
delay(3000);
digitalWrite(9, LOW);
// Debug console
Serial.begin(19200);
delay(10);
// Set GSM module baud rate
SIM900.begin(19200);
// To skip it, call init() instead of restart()
Serial.println("Initializing modem...");
modem.restart();
// Unlock your SIM card with a PIN
//modem.simUnlock("1234");
Blynk.begin(auth, modem, apn, user, pass);
// Setup a function to be called every half second
timer.setInterval(500L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
Mein Problem ist, egal wie ich die Sketche miteinander kombiniere, weder der Blynk-Daten-Push funktioniert dann, noch die ursprüngliche Displayfunktion des ZOEDisplays. Abweichend zum Urspung wurden die Bibliotheken <LiquidCrystal_I2C.h> und <LcdBarGraphX.h> statt <LiquidCrystal.h> und <LcdBarGraph.h> eingebunden. Jeder Sketch für sich funktioniert aber problemlos.