Author Topic: NODE MCU ESP2866 - Will Not Complie  (Read 116 times)

G00NOLA

  • Newbie
  • *
  • Posts: 2
NODE MCU ESP2866 - Will Not Complie
« on: May 25, 2019, 02:55:57 AM »
I am new to the RFM69 and I am trying to use it with a NODE MCU ESP8266, but I cannot get it to compile.  Am I missing a declaration or something?

#include <RFM69.h>
#include <SPIFlash.h>
#include <SPI.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
//#include <LowPower.h>
SoftwareSerial ss(12, 13);
TinyGPSPlus gps;  //Creates a GPS object
#define IS_RFM69HW_HCW;
#define NETWORKID = 10;
#define MYNODEID = 1;
#define TONODEID = 2;
#define FREQUENCY RF69_915MHZ;
#define ENCRYPT true;
#define ENCRYPTKEY "Track";
#define USEACK true;
RFM69 radio;
double setLat;  //Variable for storing the set point latitude
double setLon;  //Variable for storing the set point longitude
double compLat;  //Variable for storing the compared latitude
double compLon;  //Variable for storing the compared longitude
const int pot = 0;  //The potientiometer is on Analof Pin 0
int D;  //Variable for stoeing distance
int setD;
int potVal;  //Variable doe storing the potentiometer reading
int condition = 0;
int lastCondition = 0;
int valD;

void setup() {
Serial.begin(9600);
ss.begin(9600);
radio.initialize(FREQUENCY, MYNODEID, NETWOEKID);
radio.setHighPower();
if(ENCRYPT)
  radio.encrypt(ENCRYPTKEY);
}

void loop() {
if (setD == 0)
  {
  valD=analogRead(pot);
  setD=map(valD, 4, 1024, 10, 90);
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
    {         
     if (gps.location.isValid())
      {
      setLat=gps.location.lat();
      setLon=gps.location.lng();
      condition = 1;
      radio.sendWithRetry(TONODEID, &condition, 1);
      }
    }
  }
while (ss.available() > 0)   
    if (gps.encode(ss.read()))
      {
      if (gps.location.isValid())
        {
        compLat=gps.location.lat();
        compLon=gps.location.lng();
        D=gps.distanceBetween(compLat, compLon, setLat, setLon);  //Calculate delta distance
        if (setD <= D)
          {
          condition = 3;
          }
        else
          {
          condition = 2;
          }
        Serial.flush();
        }
      }
if (lastCondition != condition)
  {
  radio.sendWithRetry(TONODEID, &condition, 1);
  }
lastCondition = condition;     
}   

TomWS

  • Hero Member
  • *****
  • Posts: 1877
Re: NODE MCU ESP2866 - Will Not Complie
« Reply #1 on: May 25, 2019, 08:23:18 AM »
Before adding the RFM69 library, have you gotten anything to compile for your ESP8266?

What error messages did you get when you tried to compile?

A quick look at your code I found several errors:
Code: [Select]
// BAD defines: (don't use equals sign or semicolon)
#define NETWORKID = 10;
#define MYNODEID = 1;
#define TONODEID = 2;
#define ENCRYPTKEY "Track";   // encrypt key must be exactly 16 bytes long
#define USEACK true;

// MISSPELLED NETWORKID
radio.initialize(FREQUENCY, MYNODEID, NETWOEKID);

G00NOLA

  • Newbie
  • *
  • Posts: 2
Re: NODE MCU ESP2866 - Will Not Complie
« Reply #2 on: May 25, 2019, 11:33:09 AM »
Thank you, TomWS I still need to do some testing but at least is has complied.