[SOLVED] Cant combine geophone project with LoRa project

I am new to programming and I am trying to combine two sets of code (heltec LoRa esp32 OLED sender example, and an Adafruit ADS1115 amplifier comparator example. I have a geophone connected to a Gikfun 20A Range Current Sensor, which is connected to the ADS115, and that finally connects to the Heltec ESP32 LoRa OLED (I know its alot). Separately these codes work just fine. If I only upload the comparator project, the serial monitor reads the stimuli correctly. When I only upload the sender example the LoRa board properly communicates with my other heltec LoRa esp32 OLED reciever setup. But when I try to combine the two the serial monitor and serial plotter stop functioning. I am trying to have the LoRa module send a packet only if the Geophone detects vibration. Here are is the code below. Any suggestions? I've been stuck for 2 weeks

#include "heltec.h"
#include "images.h"

#define BAND    915E6  //you can set band here directly,e.g. 868E6,915E6
#include <Adafruit_ADS1X15.h>

// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1115 ads;     /* Use this for the 12-bit version */
unsigned int counter = 0;
String rssi = "RSSI --";
String packSize = "--";
String packet ;
int ledPin = 13 //using pin 13 to blink the LED when the geophone is tapped 

void logo()
{
  Heltec.display->clear();
  Heltec.display->drawXbm(0, 5, logo_width, logo_height, logo_bits);
  Heltec.display->display();
}

void flash() {
  digitalWrite(ledPin, HIGH);
  delay(100);
  digitalWrite(ledPin, LOW);
}
void message()
{
  Heltec.display->clear();

  Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
  Heltec.display->setFont(ArialMT_Plain_10);

  Heltec.display->drawString(0, 0, "Sending packet: ");
  Heltec.display->drawString(90, 0, String(counter));
  Heltec.display->display();

  // send packet
  LoRa.beginPacket();

  /*
     LoRa.setTxPower(txPower,RFOUT_pin);
     txPower -- 0 ~ 20
     RFOUT_pin could be RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
       - RF_PACONFIG_PASELECT_PABOOST -- LoRa single output via PABOOST, maximum output 20dBm
       - RF_PACONFIG_PASELECT_RFO     -- LoRa single output via RFO_HF / RFO_LF, maximum output 14dBm
  */
  LoRa.setTxPower(14, RF_PACONFIG_PASELECT_PABOOST);
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");

  Serial.println("Single-ended readings from AIN0 with >3.0V comparator");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  Serial.println("Comparator Threshold: 1000 (3.000V)");

  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV

  if (!ads.begin()) {
    Serial.println("Failed to initialize ADS.");
    while (1);
  }
  // Setup 3V comparator on channel 0
  ads.startComparator_SingleEnded(0, 1000);

  //WIFI Kit series V1 not support Vext control
  Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);

  Heltec.display->init();
  Heltec.display->flipScreenVertically();
  Heltec.display->setFont(ArialMT_Plain_10);
  logo();
  delay(1500);
  Heltec.display->clear();

  Heltec.display->drawString(0, 0, "Heltec.LoRa Initial success!");
  Heltec.display->display();
  delay(1000);
}

void loop()
{
  int adc0;

  // Comparator will only de-assert after a read
  adc0 = ads.getLastConversionResults();
  Serial.print("AIN0: "); Serial.println(adc0);
  if (adc0 > 0 ) {
    flash();
    message();
  } else if (adc0 < -1 ) {
    flash();
    message();
  }

  delay(100);
}

What level is your understanding of the operation of each sketch, individually? What was your strategy or approach for the merge? Can you not post the original sketches, or link to them if they are static examples? Are there long do-nothing delays in either sketch?

My level of understanding is pretty basic but I've been experimenting with both projects separately. I got the two LoRa esp32 to send data packets to the other using the example project listed below

/*
  This is a simple example show the Heltec.LoRa sended data in OLED.

  The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
  OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
  ware to OLED's reset pin, the low-level signal at least 5ms.

  OLED pins to ESP32 GPIOs via this connecthin:
  OLED_SDA -- GPIO4
  OLED_SCL -- GPIO15
  OLED_RST -- GPIO16
  
  by Aaron.Lee from HelTec AutoMation, ChengDu, China
  成都惠利特自动化科技有限公司
  https://heltec.org
  
  this project also realess in GitHub:
  https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series
*/

#include "heltec.h"
#include "images.h"

#define BAND    868E6  //you can set band here directly,e.g. 868E6,915E6

unsigned int counter = 0;
String rssi = "RSSI --";
String packSize = "--";
String packet ;

void logo()
{
  Heltec.display->clear();
  Heltec.display->drawXbm(0,5,logo_width,logo_height,logo_bits);
  Heltec.display->display();
}

void setup()
{
   //WIFI Kit series V1 not support Vext control
  Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
 
  Heltec.display->init();
  Heltec.display->flipScreenVertically();  
  Heltec.display->setFont(ArialMT_Plain_10);
  logo();
  delay(1500);
  Heltec.display->clear();
  
  Heltec.display->drawString(0, 0, "Heltec.LoRa Initial success!");
  Heltec.display->display();
  delay(1000);
}

void loop()
{
  Heltec.display->clear();
  Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
  Heltec.display->setFont(ArialMT_Plain_10);
  
  Heltec.display->drawString(0, 0, "Sending packet: ");
  Heltec.display->drawString(90, 0, String(counter));
  Heltec.display->display();

  // send packet
  LoRa.beginPacket();
  
/*
 * LoRa.setTxPower(txPower,RFOUT_pin);
 * txPower -- 0 ~ 20
 * RFOUT_pin could be RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
 *   - RF_PACONFIG_PASELECT_PABOOST -- LoRa single output via PABOOST, maximum output 20dBm
 *   - RF_PACONFIG_PASELECT_RFO     -- LoRa single output via RFO_HF / RFO_LF, maximum output 14dBm
*/
  LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

I have also managed to get the Geophone to function properly using the same micro controller (Heltec esp32 LoRa). Im using an amplifier for a better analog input for the geophone and even attached a small LED to give my phyiscal feedback of the project along side the serial monitor and serial plotter. the code i used is listed below

#include <Adafruit_ADS1X15.h>

// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1115 ads;     /* Use this for the 12-bit version */
int ledPin = 13 //using pin 13 to blink the LED when the geophone is tapped 


void flash() {
  digitalWrite(ledPin, HIGH);
  delay(100);
  digitalWrite(ledPin, LOW);
}

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");

  Serial.println("Single-ended readings from AIN0 with >3.0V comparator");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  Serial.println("Comparator Threshold: 1000 (3.000V)");

  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV

  if (!ads.begin()) {
    Serial.println("Failed to initialize ADS.");
    while (1);
  }
  // Setup 3V comparator on channel 0
  ads.startComparator_SingleEnded(0, 1000);


void loop()
{
  int adc0;

  // Comparator will only de-assert after a read
  adc0 = ads.getLastConversionResults();
  Serial.print("AIN0: "); Serial.println(adc0);
  if (adc0 > 0 ) {
    flash();
  } else if (adc0 < -1 ) {
    flash();
  }

  delay(100);
}

I only have one delay in the program at the end, and its only a 10th of a second.

That is more than enough to crash a lot of programs. You need to investigate. One way would be to add a 100ms delay to the sketch that doesn't currently have it, and see if it still works.

You didn't say which program the delay was inherited from...

What about this? It's 2000 ms.

ahh i didnt even realize i copied that into my combined project. I'll remove the delays and give it a try again.

So I got rid of the delays except for the 100 ms one at the end of the program and the serial monitor is working again but it's crashing. Do you think it would be better to use millis() instead of delays?
new formatted code below.

#include <Adafruit_ADS1X15.h>
#include "heltec.h"
#include "images.h"

#define BAND    915E6  //you can set band here directly,e.g. 868E6,915E6
// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1015 ads;     /* Use this for the 12-bit version */

// these constants won't change:
int16_t geophone = 36; // the piezo is connected to analog pin 0
int threshold1 = 0;  // threshold value to decide when the detected sound is a knock or not
int threshold2 = -1;  // threshold value to decide when the detected sound is a knock or not

// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin
unsigned int counter = 0;
String rssi = "RSSI --";
String packSize = "--";
String packet ;
void GEOsetup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");

  Serial.println("Single-ended readings from AIN0 with >3.0V comparator");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  Serial.println("Comparator Threshold: 1000 (3.000V)");

  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV

  if (!ads.begin()) {
    Serial.println("Failed to initialize ADS.");
    while (1);
  }
  // Setup 3V comparator on channel 0
  ads.startComparator_SingleEnded(0, 1000);
  
}

void logo()
{
  Heltec.display->clear();
  Heltec.display->drawXbm(0,5,logo_width,logo_height,logo_bits);
  Heltec.display->display();
}
void setup() {
  GEOsetup();
  Serial.begin(9600);       // use the serial port
   //WIFI Kit series V1 not support Vext control
  Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
 
  Heltec.display->init();
  Heltec.display->flipScreenVertically();  
  Heltec.display->setFont(ArialMT_Plain_10);
  logo();
 
  Heltec.display->clear();
  
  Heltec.display->drawString(0, 0, "Heltec.LoRa Initial success!");
  Heltec.display->display();
  
  
}


void loop() {
  // read the sensor and store it in the variable sensorReading:
  geophone = ads.getLastConversionResults();
  sensorReading = (geophone);
  Serial.print("GEOPHONE: "); Serial.println(geophone);
  // if the sensor reading is greater than the threshold:
  if (geophone > threshold1) {
   Heltec.display->clear();
  Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
  Heltec.display->setFont(ArialMT_Plain_10);
  
  Heltec.display->drawString(0, 0, "Sending packet: ");
  Heltec.display->drawString(90, 0, String(counter));
  Heltec.display->display();

  // send packet
  LoRa.beginPacket();
  
/*
 * LoRa.setTxPower(txPower,RFOUT_pin);
 * txPower -- 0 ~ 20
 * RFOUT_pin could be RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
 *   - RF_PACONFIG_PASELECT_PABOOST -- LoRa single output via PABOOST, maximum output 20dBm
 *   - RF_PACONFIG_PASELECT_RFO     -- LoRa single output via RFO_HF / RFO_LF, maximum output 14dBm
*/
  LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;
    // send the string "Knock!" back to the computer, followed by newline
    Serial.print("--Knock!"); Serial.println(geophone); 
    }
    if (geophone < threshold2) {
    Heltec.display->clear();
  Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
  Heltec.display->setFont(ArialMT_Plain_10);
  
  Heltec.display->drawString(0, 0, "Sending packet: ");
  Heltec.display->drawString(90, 0, String(counter));
  Heltec.display->display();

  // send packet
  LoRa.beginPacket();
  
/*
 * LoRa.setTxPower(txPower,RFOUT_pin);
 * txPower -- 0 ~ 20
 * RFOUT_pin could be RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
 *   - RF_PACONFIG_PASELECT_PABOOST -- LoRa single output via PABOOST, maximum output 20dBm
 *   - RF_PACONFIG_PASELECT_RFO     -- LoRa single output via RFO_HF / RFO_LF, maximum output 14dBm
*/
  LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);
  LoRa.print("Stimulant: ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;
    // send the string "Knock!" back to the computer, followed by newline
    Serial.print("--Knock!"); Serial.println(geophone); 
    
  }
  delay(100);  // delay to avoid overloading the serial port buffer
}

this is what I am getting now in my serial monitor.

You need to be more meticulous about repetition. There are two Serial.begin() statements. That in itself might get swept under the rug, but it's a sign that the sketches haven't been closely compared.

So I've doctored the program and removed the delay and replaced it with millis() to get the program to cycle without having to stop the program using delays. The serial monitor and serial plotter are working, but the program is crashing now. I cannot read the data inside the serial monitor in order to possibly debug with the ESP32 decoder. any tips? code posted below.

#include <Adafruit_ADS1X15.h>
#include <heltec.h>
#include "images.h"
#define BAND    915E6  //you can set band here directly,e.g. 868E6,915E6
// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1115 ads;    


int16_t GPI36; // the ADS is connected to analog pin 36
int threshold = constrain(threshold, 0, -1);  // threshold value to decide when the detected noise triggers the LoRa to send a message
unsigned int sensorReading = 0;      // variable to store the value read from the sensor pin
unsigned int counter = 0;
String rssi = "RSSI --";
String packSize = "--";
String packet ;
unsigned long geoStartMillis;
unsigned long currentMillis;
const unsigned long geoPeriod = 100;  //sensor read period



void setup()
{
  Serial.begin(9600);       // use the serial port
  Serial.println("Hello!");
  Serial.println("Single-ended readings from AIN0 with >3.0V comparator");
  Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
  Serial.println("Comparator Threshold: 1000 (3.000V)");
  amplify();
  heltec_begin();
  geoStartMillis = millis();  //start time of geophone

}

void loop()
{
  currentMillis = millis();  //get the current time
  geo();


}

void geo()  //function to get updated geophone reading
{
  if (currentMillis - geoStartMillis >= geoPeriod)  //test whether the period has elapsed
  {
    getReading();
    geoStartMillis = currentMillis;  
  }
}


void amplify()
{
  if (!ads.begin()) {
    Serial.println("Failed to initialize ADS.");
    while (1);
  }
  // Setup 3V comparator on channel 0
  ads.startComparator_SingleEnded(0, 1000);
}

int getReading()
{
  // read the sensor and store it in the variable sensorReading:
  sensorReading = ads.getLastConversionResults();
  Serial.print("GEOPHONE: "); Serial.println(sensorReading);
  // if the sensor reading is greater than the threshold:
  if (sensorReading = !threshold) {
    heltec_send();
  }
}


void logo() //logo display
{
  Heltec.display->clear();
  Heltec.display->drawXbm(0, 5, logo_width, logo_height, logo_bits);
  Heltec.display->display();
}

void heltec_begin() //setup for heltec LoRa 32 
{
  //WIFI Kit series V1 not support Vext control
  Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);

  Heltec.display->init();
  Heltec.display->flipScreenVertically();
  Heltec.display->setFont(ArialMT_Plain_10);
  logo();
  Heltec.display->clear();
  Heltec.display->drawString(0, 0, "Heltec.LoRa Initial success!");
  Heltec.display->display();
}


void heltec_send() //send LoRa message 
{
  Heltec.display->clear();
  Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
  Heltec.display->setFont(ArialMT_Plain_10);

  Heltec.display->drawString(0, 0, "Sending packet: ");
  Heltec.display->drawString(90, 0, String(counter));
  Heltec.display->display();
  LoRa.beginPacket();

  /*
     LoRa.setTxPower(txPower,RFOUT_pin);
     txPower -- 0 ~ 20
     RFOUT_pin could be RF_PACONFIG_PASELECT_PABOOST or RF_PACONFIG_PASELECT_RFO
       - RF_PACONFIG_PASELECT_PABOOST -- LoRa single output via PABOOST, maximum output 20dBm
       - RF_PACONFIG_PASELECT_RFO     -- LoRa single output via RFO_HF / RFO_LF, maximum output 14dBm
  */
  LoRa.setTxPower(14, RF_PACONFIG_PASELECT_PABOOST);
  LoRa.print("Stimulant ");
  LoRa.print(counter);
  LoRa.endPacket();
  Serial.print("--Alert!"); Serial.println(sensorReading);
  counter++;


}

We need a more detailed report.

Just to be clear, is this the combined sketch?

Can you post the entire serial output for us?

the lora board OLED displays: "Heltec.LoRa Initial success!", but doesn't send data packets to the secondary Heltec LoRa32(V2) i have powered up programed with the sister example "receiver" code that is meant to go with the "Sender" code i have in this program and the raw example it's derived from which is listed below.

/*
  This is a simple example show the Heltec.LoRa recived data in OLED.

  The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
  OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
  ware to OLED's reset pin, the low-level signal at least 5ms.

  OLED pins to ESP32 GPIOs via this connecthin:
  OLED_SDA -- GPIO4
  OLED_SCL -- GPIO15
  OLED_RST -- GPIO16
  
  by Aaron.Lee from HelTec AutoMation, ChengDu, China
  成都惠利特自动化科技有限公司
  www.heltec.cn
  
  this project also realess in GitHub:
  https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series
*/
#include "heltec.h" 
#include "images.h"

#define BAND    433E6  //you can set band here directly,e.g. 868E6,915E6
String rssi = "RSSI --";
String packSize = "--";
String packet ;

void logo(){
  Heltec.display->clear();
  Heltec.display->drawXbm(0,5,logo_width,logo_height,logo_bits);
  Heltec.display->display();
}

void LoRaData(){
  Heltec.display->clear();
  Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
  Heltec.display->setFont(ArialMT_Plain_10);
  Heltec.display->drawString(0 , 15 , "Received "+ packSize + " bytes");
  Heltec.display->drawStringMaxWidth(0 , 26 , 128, packet);
  Heltec.display->drawString(0, 0, rssi);  
  Heltec.display->display();
}

void cbk(int packetSize) {
  packet ="";
  packSize = String(packetSize,DEC);
  for (int i = 0; i < packetSize; i++) { packet += (char) LoRa.read(); }
  rssi = "RSSI " + String(LoRa.packetRssi(), DEC) ;
  LoRaData();
}

void setup() { 
   //WIFI Kit series V1 not support Vext control
  Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
 
  Heltec.display->init();
  Heltec.display->flipScreenVertically();  
  Heltec.display->setFont(ArialMT_Plain_10);
  logo();
  delay(1500);
  Heltec.display->clear();
  
  Heltec.display->drawString(0, 0, "Heltec.LoRa Initial success!");
  Heltec.display->drawString(0, 10, "Wait for incoming data...");
  Heltec.display->display();
  delay(1000);
  //LoRa.onReceive(cbk);
  LoRa.receive();
}

void loop() {
  int packetSize = LoRa.parsePacket();
  if (packetSize) { cbk(packetSize);  }
  delay(10);
}

I tap around the geophone and even shake it to try and get a reading, nothing. I check the serial monitor to see if the program is displaying the serial print lines I added to verify if the ADS is registering input. The Serial monitor displays random symbols as listed below.

 ⸮+⸮ ⸮ ⸮⸮⸮ ⸮ ⸮ ⸮ ⸮⸮⸮ ⸮ ⸮⸮⸮ ⸮ ⸮⸮⸮⸮⸮ ⸮⸮⸮ ⸮⸮⸮⸮⸮⸮⸮ ⸮ ⸮ ⸮⸮⸮⸮⸮⸮⸮ ⸮⸮⸮ ⸮	⸮ ⸮⸮⸮ ⸮ ⸮ ⸮
⸮
⸮ ⸮⸮⸮ ⸮⸮⸮j⸮	⸮ ⸮ ⸮ ⸮⸮⸮ ⸮⸮⸮	⸮⸮⸮ ⸮ ⸮ ⸮ ⸮⸮⸮⸮⸮⸮⸮ ⸮⸮⸮ ⸮⸮⸮ ⸮⸮⸮ ⸮⸮⸮+⸮⸮⸮ ⸮⸮⸮ ⸮ ⸮⸮⸮ ⸮⸮⸮ ⸮⸮⸮ ⸮⸮⸮⸮⸮⸮⸮ ⸮⸮⸮ ⸮ ⸮⸮⸮⸮⸮⸮⸮ ⸮⸮⸮⸮⸮⸮⸮ ⸮ ⸮ ⸮ ⸮ ⸮ ⸮⸮⸮⸮⸮	⸮ ⸮ ⸮⸮⸮(⸮ ⸮⸮⸮ ⸮ ⸮⸮⸮⸮⸮⸮⸮(⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮

this is the combined sketch

This is a very strange use of the not operator with an integer value. Very irregular. Is it intentional? If so, explain, if not explain. Edit - a pretty strange use of constrain() as well.

The reverse question marks are usually just caused by the wrong baud rate selection. Let's focus on that now, so we can see what the program is printing...

I don't see any Serial.begin()...

it is intentional. I was trying to have a threshold range for when to send a data packet. The ADS comparator is used to compare a measurable quantity with a reference or standard such as two voltages or currents. the range i observed in the original comparator sketch (the geophone example sketch above) was between 0 and -1. It bounced back between the two and when the geophone is vibrated it reads either numbers above 0 or below -1. The greater the difference, shows the amount of voltage created by the geophone by means of vibration. I thought i was setting the threshold to be either 0 or -1 and if it was NOT one of thos numbers, it would trigger the command to send a data packet in the if statement in the
getReading() function

int getReading()
{
  // read the sensor and store it in the variable sensorReading:
  sensorReading = ads.getLastConversionResults();
  Serial.print("GEOPHONE: "); Serial.println(sensorReading);
  // if the sensor reading is greater than the threshold:
  if (sensorReading = !threshold) {
    heltec_send();
  }
}

Okay, roughly one out of three issues answered... remaining are:

  • no serial setup
  • why you use the not operator, what you hope it does.. oh sorry you did answer that but you are completely off base. Not even close. '!' is for use in boolean expressions, and shouldn't normally be used with integers.

my apologies, the "Receiver " Heltec LoRa32 example is one i pulled from the Arduino online IDE on my work computer. The one I used from home has the same serial begin of (9600). The receiver I'm using is functioning properly. I uploaded both sender and receiver examples to the respective boards and the establish a connection and send data packets. The only issue I am having is my combined project.

Then please assemble the correct code and re post it here when you have time.

any tips for setting a better threshold, again sorry if this is frustrating, I'm still very new to programming and am constantly trying to research ways to get my program to function. I appreciate the help.