I am using GSM SIM 800L with a Teensy 3.2 board. I want to send data every 2ms from Teensy via GSM to my database. I tried sending it but I cannot get consistent data, if I do not put delay after some HTTP commands. I am fine with putting delay after commands used in setup() function. I do not want any delay under my 2ms task. Is there a way to get consistent data in my database without using any delay?
By consistent data, what I mean is - If there is no delay in 2ms task after HTTPACTION command, I do not receive all values in the database. The counter jumps from 1 to 15 and so on. I miss the data in between.
Please find the code below. I have not added the code for loop function.
struct student {
int id;
int marks;
};
dtostrf(stu.id,7, 2, val);
Why on earth are you expecting two decimals places from an int? Why are you using the Double To STRing Formatted function to convert an int to a string?
Why are you using SoftwareSerial, when the Teensy has more than one hardware serial port?
Why are you using write() to print data?
Most importantly, why do you ASSUME that every AT command will succeed? Why do you NEVER read ant response from the modem?
Why do you think you need to send a student ID and grade to the database every two milliseconds?
Why on earth are you expecting two decimals places from an int? Why are you using the Double To STRing Formatted function to convert an int to a string?
I will change it.
Why are you using SoftwareSerial, when the Teensy has more than one hardware serial port?
I might need other ports for different purposes.
Why are you using write() to print data?
I will change it.
Most importantly, why do you ASSUME that every AT command will succeed? Why do you NEVER read ant response from the modem?
I do not know how to do this. Can you point me in the right direction?
Why do you think you need to send a student ID and grade to the database every two milliseconds?
I want to send different information to the database. I was doing this to ensure if everything is working correctly. Then later I can prepare the data and modify the php file as needed.
You know how to send data to this forum, and read replies. But you don't know how to determine if there are any replies available() from the modem, or how to read() them. Unbelievable.
I want to send different information to the database.
I seriously doubt that the hardware and all the processes involved will allow you to update a database, using a GSM modem, every 2 milliseconds, but feel free to try.
During testing, sending more realistic data would certainly be in order.
PaulS:
You know how to send data to this forum, and read replies. But you don't know how to determine if there are any replies available() from the modem, or how to read() them. Unbelievable.
Thanks, I understood what you meant here.
I seriously doubt that the hardware and all the processes involved will allow you to update a database, using a GSM modem, every 2 milliseconds, but feel free to try.
I tried it but even with this small amount of data, it cannot correctly reflect in the database.
During testing, sending more realistic data would certainly be in order.
Yes, the realistic data is coming continuously from another hardware. Processing it in 2ms or the latest 5ms is important.