Hello,
i’m trying to transfer the serial data recieved from any Serially connected device to the data buckets. I’m using the TinyGSM library along with thinger library.
So in order to test, I have written a code which basically takes the data recieved in the Serial port3 of my Arduino Mega, and transfers it as a string to the data buckets. But my problem is that always a weird number comes in the data bucket.
Is there something I’m doing wrong?
Help me plz.
The code is given below
#define TINY_GSM_MODEM_SIM900
#define _DEBUG_
#include <TinyGsmClient.h>
#include <ThingerTinyGSM.h>
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
#endif
#define USERNAME "MyUsername"
#define DEVICE_ID ""
#define DEVICE_CREDENTIAL ""
#define APN_NAME "MyAPN"
#define APN_USER ""
#define APN_PSWD ""
#define CARD_PIN ""
char console[128];
ThingerTinyGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);
void setup() {
Serial.begin(19200);
Serial3.begin(19200);
Serial1.begin(19200); //The Sim900 is connected here
pinMode(13, OUTPUT);
thing["led"] << [](pson& in){
digitalWrite(13, in ? HIGH:LOW);
};
thing["RxedBits"] >> [](pson &out){
out=( string)( string(Serial3.read()));
};
}
void loop() {
thing.handle();
while(Serial3.available())
thing.write_bucket("RxedBits","RxedBits");
delay(10000);
}