Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Jacinth
#96069 I am working on a project that involves i2c communication with 3 sensors and I am trying to read GPS once or everytime the system initializes..My GPS module is from Ublox Neo 6M and it does work with serial communication (TinyGPS library always put up error so I use a simple GPS program to get NMEA value)
Code: Select all#include <SoftwareSerial.h>
SoftwareSerial ss(12, 13); // GPS Module’s TX to 12 (D6)& RX to 13 (D7)

void setup(){


Serial.begin(115200);
ss.begin(9600);

}


void loop(){

while (ss.available() > 0){

byte gpsData = ss.read();

Serial.write(gpsData);

}

}

once put within a function call in a loop with other sensors
Code: Select all#include "Wire.h"
#include "Adafruit_VL53L0X.h"
#include "Max44009.h"
#include "Adafruit_AS726x.h"
#include <SoftwareSerial.h>

SoftwareSerial ss(12, 13); // GPS Module’s TX to 12 (D6)& RX to 13 (D7)
Adafruit_VL53L0X lox = Adafruit_VL53L0X();//tof
Max44009 myLux(0x4a); //lux address
uint32_t lastDisplay = 0; //lux
//create the object microspectrograph
Adafruit_AS726x ams;
//buffer to hold raw values
uint16_t sensorValues[AS726x_NUM_CHANNELS];
//buffer to hold calibrated values (not used by default in this example)
float calibratedValues[AS726x_NUM_CHANNELS];


void setup() {
   Serial.begin(115200);
   ss.begin(9600);
   
  }
 

void loop() {
 
  Serial.println("Ranging data");
  tofsensor();
  delay(2000);
  Serial.println("Light intensity data");
  luxsensor();
  Serial.println();
  delay(2000);
  Serial.println("Microspectrograph data");
  microspec();
  delay(2000);
  Serial.println("Location");
  location();
  delay(2000);
// following this are functions defined as void location()...and so on

}
.. there is no output as the serial bus is busy as I understand... Is there a possible solution to initialize GPS only once and then calling up serial communication with other sensors.