Hello,
I am just starting with Arduino and I need some help coding. I found code for GPS reading and code for readings from vitals sensor, but now I am not sure how to merge these two together. Below is the code and wiring for both when they are done separately to two different Arduinos. I would like both sensors to be wired to one Arduino.
Note:(I am using an Arduino simulator, where I can connect multiple sensors to same ground pin without a breadboard).
Start with the more complex hardware (the Oxy sensor) and just add the GPS code, essentially the serial library and parser. Then, add code to print out to whatever display you wish which will require some adjustment in the positioning of the Oxy display if you wish both to be on the same screen. But, if you are just wanting a timestamp, no reason to display the GPS.
Hi, thanks for reply, even though that wasn't very helpful.
Both sketches use Serial.begin(9600) and I am wondering if this should be modified somehow when merging the code for two sensors. After all, they both have a loop if (Serial.available() > 0) .
How will the program know if data coming from serial port is gps or body temperature?
First of all - neither GPS nor Oxy sensor are not connected to the Uno Serial. The Oxy connects via I2c bus. You don't show connections for GPS module, but it can't be Serial pins because the Serial is used for uploading firmware to the board.
You described the common problems that should be solved to merge two codes. To do it, you have to figure out how both code works.Please read the link in post#3
Typical newbie answer: if you had read the link provided and incorporated the technique suggested, you would have a deeper understanding of the task-at-hand.
Clearly you are a copy&paste kind of pseudo-programmer and expect one of the knowledgeable members to do the entire combine.
I apologize for not being very helpful, but you must make an effort to learn and not just copy. Your response indicates that you have not taken time to work through examples provided with the ArduinoIDE and have no clear understanding of how variables are set by return function values.