Reading data from multiple sensors simultaneously


I am using Arduino Mega 2560. I am trying to interface two sensors. A GSM 900a sensor I am using adafruit Fona library to send sms using this module and other is a co2 sensor using another serial software. Both uses serial librari I have connected to pins 50 and 51 for 1 sensor and 52 and 53 for other sensor. I need to know how to use both these sensors simultaneously. I am able to use one sensor at a time. Both should run parallel because the data from the sensor should be messaged thru GSM module.

Kindly help regarding how to simultaneously use them in parallel

What code have you got so far? What problem have you run into? It's fairly simple, you read the sensor and then you send an sms.

If you're using a Mega 2560 and both of those sensors use a serial interface, then you should probably connect them to the hardware serial ports. It will make things run so much better than using SoftwareSerial.