Lightning sensor AS3935

Hello. I would like to build a lightning detector with the AS3935 sensor. I went to the net and found a code for a project that works with a display. I'm using an ide version 1.6.9 because I saw in the comments that the arduino ide should be 1.6.x. I downloaded the library used in this project however when compiling the code I get the following error.


the library used was the one on the page. someone can help me? or someone who has an identical project with a display. thanks

Welcome to the forums. Please take a moment and read this: How to get the best out of this forum - Using Arduino / Installation & Troubleshooting - Arduino Forum

Posting pictures of text is rarely useful. Post your code using code tags. There is also a handy button in the lower right corner "Copy error message" which will take all the error text and allow you to post is here (again using code tags)

It will help people help you.

thank you.
this is the code

[code]
#include <AS3935.h>

AS3935::AS3935(byte (*SPItransfer)(byte),int csPin, int irq);
{
  SPITransferFunc = SPItransfer;
  _CSPin = csPin;
  _IRQPin = irq;
  digitalWrite(_CSPin,HIGH);
  pinMode(_CSPin,OUTPUT);
  pinMode(_IRQPin,INPUT);
}

byte AS3935::_SPITransfer2(byte high, byte low)
{
  digitalWrite(_CSPin,LOW);
  SPITransferFunc(high);
  byte regval = SPITransferFunc(low);
  digitalWrite(_CSPin,HIGH);
  return regval;  
}

byte AS3935::_rawRegisterRead(byte reg)
{
  return _SPITransfer2((reg & 0x3F) | 0x40, 0);
}

byte AS3935::_ffsz(byte mask)
{
  byte i = 0;
  if (mask)
    for (i = 1; ~mask & 1; i++)
      mask >>= 1;
  return i;
}

void AS3935::registerWrite(byte reg, byte mask, byte data)
{
  byte regval = _rawRegisterRead(reg);
  regval &= ~(mask);
  if (mask)
    regval |= (data << (_ffsz(mask)-1));
  else
    regval |= data;
  _SPITransfer2(reg & 0x3F, regval);
}

byte AS3935::registerRead(byte reg, byte mask)
{
  byte regval = _rawRegisterRead(reg);
  regval = regval & mask;
  if (mask)
    regval >>= (_ffsz(mask)-1);
  return regval;
}

void AS3935::reset()
{
  _SPITransfer2(0x3C, 0x96);
  delay(2);
}

bool AS3935::calibrate()
{
  int target = 3125, currentcount = 0, bestdiff = INT_MAX, currdiff = 0;
  byte bestTune = 0, currTune = 0;
  unsigned long setUpTime;
  int currIrq, prevIrq;
  // set lco_fdiv divider to 0, which translates to 16
  // so we are looking for 31250Hz on irq pin
  // and since we are counting for 100ms that translates to number 3125
  // each capacitor changes second least significant digit
  // using this timing so this is probably the best way to go
  registerWrite(AS3935_LCO_FDIV,0);
  registerWrite(AS3935_DISP_LCO,1);
  // tuning is not linear, can't do any shortcuts here
  // going over all built-in cap values and finding the best
  for (currTune = 0; currTune <= 0x0F; currTune++) 
  {
    registerWrite(AS3935_TUN_CAP,currTune);
    // let it settle
    delay(2);
    currentcount = 0;
    prevIrq = digitalRead(_IRQPin);
    setUpTime = millis() + 100;
    while((long)(millis() - setUpTime) < 0)
    {
      currIrq = digitalRead(_IRQPin);
      if (currIrq > prevIrq)
      {
        currentcount++; 
      }
      prevIrq = currIrq;
    }
    currdiff = target - currentcount;
    // don't look at me, abs() misbehaves
    if(currdiff < 0)
      currdiff = -currdiff;
    if(bestdiff > currdiff)
    {
      bestdiff = currdiff;
      bestTune = currTune;
    }
  }
  registerWrite(AS3935_TUN_CAP,bestTune);
  delay(2);
  registerWrite(AS3935_DISP_LCO,0);
  // and now do RCO calibration
  powerUp();
  // if error is over 109, we are outside allowed tuning range of +/-3.5%
  return bestdiff > 109?false:true;
} 

void AS3935::powerDown()
{
  registerWrite(AS3935_PWD,1);
}

void AS3935::powerUp()
{
  registerWrite(AS3935_PWD,0);
  _SPITransfer2(0x3D, 0x96);
  delay(3);
}

int AS3935::interruptSource()
{
  return registerRead(AS3935_INT);
}

void AS3935::disableDisturbers()
{
  registerWrite(AS3935_MASK_DIST,1);
}

void AS3935::enableDisturbers()
{
  registerWrite(AS3935_MASK_DIST,0);
}

int AS3935::getMinimumLightnings()
{
  return registerRead(AS3935_MIN_NUM_LIGH);
}

int AS3935::setMinimumLightnings(int minlightning)
{
  registerWrite(AS3935_MIN_NUM_LIGH,minlightning);
  return getMinimumLightnings();
}

int AS3935::lightningDistanceKm()
{
  return registerRead(AS3935_DISTANCE);
}

void AS3935::setIndoors()
{
  registerWrite(AS3935_AFE_GB,AS3935_AFE_INDOOR);
}

void AS3935::setOutdoors()
{
  registerWrite(AS3935_AFE_GB,AS3935_AFE_OUTDOOR);
}
[/code]

this is the error

Arduino: 1.6.9 (Windows 10), Placa:"Arduino Uno"

sketch_dec15c:3: error: prototype for 'AS3935::AS3935(byte (*)(byte), int, int)' does not match any in class 'AS3935'

 AS3935::AS3935(byte (*SPItransfer)(byte),int csPin, int irq)

 ^~~~~~

In file included from C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino:1:0:

C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\AS3935\src/AS3935.h:9:7: error: candidates are: AS3935::AS3935(AS3935&&)

 class AS3935 {

       ^~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\AS3935\src/AS3935.h:9:7: error:                 AS3935::AS3935(const AS3935&)

C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\AS3935\src/AS3935.h:43:2: error:                 AS3935::AS3935()

  AS3935(void);

  ^~~~~~

sketch_dec15c:13: error: no 'byte AS3935::_SPITransfer2(byte, byte)' member function declared in class 'AS3935'

 byte AS3935::_SPITransfer2(byte high, byte low)

                                               ^

sketch_dec15c:22: error: no 'byte AS3935::_rawRegisterRead(byte)' member function declared in class 'AS3935'

 byte AS3935::_rawRegisterRead(byte reg)

                                       ^

sketch_dec15c:27: error: no 'byte AS3935::_ffsz(byte)' member function declared in class 'AS3935'

 byte AS3935::_ffsz(byte mask)

                             ^

sketch_dec15c:36: error: no 'void AS3935::registerWrite(byte, byte, byte)' member function declared in class 'AS3935'

 void AS3935::registerWrite(byte reg, byte mask, byte data)

                                                          ^

sketch_dec15c:47: error: no 'byte AS3935::registerRead(byte, byte)' member function declared in class 'AS3935'

 byte AS3935::registerRead(byte reg, byte mask)

                                              ^

sketch_dec15c:56: error: no 'void AS3935::reset()' member function declared in class 'AS3935'

 void AS3935::reset()

                    ^

C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino: In member function 'bool AS3935::calibrate()':

sketch_dec15c:64: error: 'INT_MAX' was not declared in this scope

   int target = 3125, currentcount = 0, bestdiff = INT_MAX, currdiff = 0;

                                                   ^~~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino:64:51: note: suggested alternative: 'INT8_MAX'

   int target = 3125, currentcount = 0, bestdiff = INT_MAX, currdiff = 0;

                                                   ^~~~~~~

                                                   INT8_MAX

sketch_dec15c:73: error: 'AS3935_LCO_FDIV' was not declared in this scope

   registerWrite(AS3935_LCO_FDIV,0);

                 ^~~~~~~~~~~~~~~

sketch_dec15c:73: error: 'registerWrite' was not declared in this scope

   registerWrite(AS3935_LCO_FDIV,0);

   ^~~~~~~~~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino:73:3: note: suggested alternative: 'digitalWrite'

   registerWrite(AS3935_LCO_FDIV,0);

   ^~~~~~~~~~~~~

   digitalWrite

sketch_dec15c:74: error: 'AS3935_DISP_LCO' was not declared in this scope

   registerWrite(AS3935_DISP_LCO,1);

                 ^~~~~~~~~~~~~~~

sketch_dec15c:79: error: 'AS3935_TUN_CAP' was not declared in this scope

     registerWrite(AS3935_TUN_CAP,currTune);

                   ^~~~~~~~~~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino:79:19: note: suggested alternative: 'AS3935_VERSION'

     registerWrite(AS3935_TUN_CAP,currTune);

                   ^~~~~~~~~~~~~~

                   AS3935_VERSION

sketch_dec15c:83: error: '_IRQPin' was not declared in this scope

     prevIrq = digitalRead(_IRQPin);

                           ^~~~~~~

sketch_dec15c:94: error: 'currdiff' was not declared in this scope

     currdiff = target - currentcount;

     ^~~~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino:94:5: note: suggested alternative: 'currIrq'

     currdiff = target - currentcount;

     ^~~~~~~~

     currIrq

sketch_dec15c:104: error: 'AS3935_TUN_CAP' was not declared in this scope

   registerWrite(AS3935_TUN_CAP,bestTune);

                 ^~~~~~~~~~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino:104:17: note: suggested alternative: 'AS3935_VERSION'

   registerWrite(AS3935_TUN_CAP,bestTune);

                 ^~~~~~~~~~~~~~

                 AS3935_VERSION

sketch_dec15c:108: error: 'powerUp' was not declared in this scope

   powerUp();

   ^~~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\sketch_dec15c\sketch_dec15c.ino: At global scope:

sketch_dec15c:113: error: no 'void AS3935::powerDown()' member function declared in class 'AS3935'

 void AS3935::powerDown()

                        ^

sketch_dec15c:118: error: no 'void AS3935::powerUp()' member function declared in class 'AS3935'

 void AS3935::powerUp()

                      ^

sketch_dec15c:125: error: no 'int AS3935::interruptSource()' member function declared in class 'AS3935'

 int AS3935::interruptSource()

                             ^

sketch_dec15c:130: error: no 'void AS3935::disableDisturbers()' member function declared in class 'AS3935'

 void AS3935::disableDisturbers()

                                ^

sketch_dec15c:135: error: no 'void AS3935::enableDisturbers()' member function declared in class 'AS3935'

 void AS3935::enableDisturbers()

                               ^

sketch_dec15c:140: error: no 'int AS3935::getMinimumLightnings()' member function declared in class 'AS3935'

 int AS3935::getMinimumLightnings()

                                  ^

sketch_dec15c:145: error: no 'int AS3935::setMinimumLightnings(int)' member function declared in class 'AS3935'

 int AS3935::setMinimumLightnings(int minlightning)

                                                  ^

sketch_dec15c:151: error: no 'int AS3935::lightningDistanceKm()' member function declared in class 'AS3935'

 int AS3935::lightningDistanceKm()

                                 ^

sketch_dec15c:156: error: no 'void AS3935::setIndoors()' member function declared in class 'AS3935'

 void AS3935::setIndoors()

                         ^

sketch_dec15c:161: error: no 'void AS3935::setOutdoors()' member function declared in class 'AS3935'

 void AS3935::setOutdoors()

                          ^

Foram encontradas múltiplas bibliotecas para «AS3935.h»
Utilizado: C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\AS3935
Não utilizado: C:\Program Files (x86)\Arduino\libraries\AS3935
exit status 1
prototype for 'AS3935::AS3935(byte (*)(byte), int, int)' does not match any in class 'AS3935'

Este relatório teria mais informação com a
opção «Mostrar mensagens detalhadas durante a
compilação» seleccionada nas Preferências.
Este texto será ocultado

That is the library code. You need to post your sketch - the code that contains setup() and loop(). It will call this library. You don't compile it directly.

I downloaded the reference project you posted and installed the library and it compiled just fine using 1.8.19 IDE (I would suggest you upgrade)

when you have time can you explain to me how to do that? I'm not an arduino programmer. I'm just a person who likes to put some things into practice and since I don't know how to program arduinos, I use ready-made codes. sometimes I associate codes and manage to do some funny things. thanks

We don't need to explain it here. In fact there is too much to fit here. The Arduino environment is painstakingly augmented with documentation and tutorials to help beginners get started. It's all on this site, and Google will find many other learning resources on that subject.

But also, loading and running a sketch is "Arduino 101", so you have skipped the most basic material. Loading and running the blink sketch according to the instructions was the first thing I did once my first Arduino came out of the box.

the code


/*
  Lightningdetector2.pde - AS3935 Franklin Lightning Sensor™ IC by AMS library demo code
  Code by http://microcontroller-projects.com / Teodor Costachioiu (blog [at] microcontroller-projects [dot] com)
  
  This Arduino sketch requires the AS3935 library from https://github.com/raivisr/AS3935-Arduino-Library
  
  Based on the original library and code by:
  LightningDetector.pde - AS3935 Franklin Lightning Sensor™ IC by AMS library demo code
  Copyright (c) 2012 Raivis Rengelis (raivis [at] rrkb.lv). All rights reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

#include <SPI.h>
#include <AS3935.h>
#include <SoftwareSerial.h>
#define LCD_pin 5  // LCD data signal

const int NoDetect=30;
int counter;
int NumDisturber=0;

SoftwareSerial LCD = SoftwareSerial(0, LCD_pin);

void printAS3935Registers();

// Function prototype that provides SPI transfer and is passed to
// AS3935 to be used from within library, it is defined later in main sketch.
// That is up to user to deal with specific implementation of SPI
// Note that AS3935 library requires this function to have exactly this signature
// and it can not be member function of any C++ class, which happens
// to be almost any Arduino library
// Please make sure your implementation of choice does not deal with CS pin,
// library takes care about it on it's own
byte SPItransfer(byte sendByte);
// tunecap is needed to display the calibration register value
int tunecap;

// Iterrupt handler for AS3935 irqs
// and flag variable that indicates interrupt has been triggered
// Variables that get changed in interrupt routines need to be declared volatile
// otherwise compiler can optimize them away, assuming they never get changed
void AS3935Irq();
// volatile int AS3935IrqTriggered; - not needed anymore

// First parameter - SPI transfer function, second - Arduino pin used for CS
// and finally third argument - Arduino pin used for IRQ
// It is good idea to chose pin that has interrupts attached, that way one can use
// attachInterrupt in sketch to detect interrupt
// Library internally polls this pin when doing calibration, so being an interrupt pin
// is not a requirement
AS3935 AS3935(SPItransfer,3,2); //change to AS3935(SPITransfer,9,3) if using slot #2
// AS3935 AS3935(SPItransfer,77,26); //if using Flip & Click socket A

void setup()
{
  serLCDInit(); 
  backlightOn();   
  clearLCD();
  lcdPosition(0,3);
  LCD.print("Lightining");
  lcdPosition(1,5);
  LCD.print("Sensor"); 
  delay(1500);
  clearLCD();
  
  Serial.begin(9600);
  // first begin, then set parameters
  SPI.begin();
  // NB! chip uses SPI MODE1
  SPI.setDataMode(SPI_MODE1);
  // NB! max SPI clock speed that chip supports is 2MHz,
  // but never use 500kHz, because that will cause interference
  // to lightning detection circuit
  SPI.setClockDivider(SPI_CLOCK_DIV16);
  // and chip is MSB first
  SPI.setBitOrder(MSBFIRST);
  // reset all internal register values to defaults
  AS3935.reset();
  delay(10);
  AS3935.setOutdoors();
  AS3935.registerWrite(AS3935_NF_LEV,2);  //write 2 in the Noise Level register
  //AS3935.registerWrite(AS3935_SREJ,0);  //write 2 in the Noise Level register
  // and run calibration
  // if lightning detector can not tune tank circuit to required tolerance,
  // calibration function will return false
  if(!AS3935.calibrate())
    Serial.println("Tuning out of range, check your wiring, your sensor and make sure physics laws have not changed!");
  // now we print the value in the calibration register TUN_CAP
  // it is in the range 0 - 15
  tunecap=AS3935.registerRead(AS3935_TUN_CAP);  //Internal calibration
  Serial.print("Tuning cap register is ");
  Serial.println(tunecap);

  // since this is demo code, we just go on minding our own business and ignore the fact that someone divided by zero

  // first let's turn on disturber indication and print some register values from AS3935
  // tell AS3935 we are indoors, for outdoors use setOutdoors() function
  // AS3935.setOutdoors();
  // turn on indication of distrubers, once you have AS3935 all tuned, you can turn those off with disableDisturbers()
  AS3935.enableDisturbers();
  printAS3935Registers();
  // AS3935IrqTriggered = 0;
  // Using interrupts means you do not have to check for pin being set continiously, chip does that for you and
  // notifies your code
  // demo is written and tested on ChipKit MAX32, irq pin is connected to max32 pin 2, that corresponds to interrupt 1
  // look up what pins can be used as interrupts on your specific board and how pins map to int numbers
  // ChipKit Max32 - irq connected to pin 2, or Arduino with irq connected to pin 3
  // Uncomment the next line if using slot #2 of the Arduino mikroBUS adapter
  // attachInterrupt(1,AS3935Irq,RISING);
  // uncomment line below and comment out line above for Arduino Mega 2560, irq still connected to pin 2
  attachInterrupt(0,AS3935Irq,RISING);
  // attachInterrupt(digitalPinToInterrupt(26),AS3935Irq,RISING); // if using Flip & Click socket A
}

void loop()
{
  // here we go into loop checking if interrupt has been triggered, which kind of defeats
  // the whole purpose of interrupts, but in real life you could put your chip to sleep
  // and lower power consumption or do other nifty things
  
  // I prefer to move this code inside the interrupt routine itself
  // Here I leave only some code to display "Waiting..." so I know everything works
  
  delay(1000);
  Serial.println("Waiting...");
  if (counter==0)
  {
    NumDisturber=0;
    counter=NoDetect;
    clearLCD();
    lcdPosition(0,1);
    LCD.print("No  lightining");
    lcdPosition(1,4);
    LCD.print("detected");
  }
  else
  {
    counter=counter - 1; 
  }
}

void printAS3935Registers()
{
  int noiseFloor = AS3935.getNoiseFloor();
  int spikeRejection = AS3935.getSpikeRejection();
  int watchdogThreshold = AS3935.getWatchdogThreshold();
  Serial.print("Noise floor is: ");
  Serial.println(noiseFloor,DEC);
  Serial.print("Spike rejection is: ");
  Serial.println(spikeRejection,DEC);
  Serial.print("Watchdog threshold is: ");
  Serial.println(watchdogThreshold,DEC);  
}

// this is implementation of SPI transfer that gets passed to AS3935
// you can (hopefully) wrap any SPI implementation in this
byte SPItransfer(byte sendByte)
{
  return SPI.transfer(sendByte);
}

// this is irq handler for AS3935 interrupts, has to return void and take no arguments
// always make code in interrupt handlers fast and short
void AS3935Irq()
{
  // there is no need for this flag anymore
  // AS3935IrqTriggered = 1;
   
  // I move all the code for dysplaiying events inside the interrupt routine
  // again there is no need for this flag
  // reset the flag
  // AS3935IrqTriggered = 0;
  // first step is to find out what caused interrupt
  // as soon as we read interrupt cause register, irq pin goes low
    int irqSource = AS3935.interruptSource();
    // returned value is bitmap field, bit 0 - noise level too high, bit 2 - disturber detected, and finally bit 3 - lightning!
    if (irqSource & 0b0001)
      Serial.println("Noise level too high, try adjusting noise floor");
    if (irqSource & 0b0100)
    {
      NumDisturber+=1;
      Serial.println("Disturber detected");      
      clearLCD();
      lcdPosition(0,0);
      LCD.print("Disturb. Det: ");
      LCD.print(NumDisturber,DEC);
      counter=NoDetect;
    }  
    if (irqSource & 0b1000)
    {
      // need to find how far that lightning stroke, function returns approximate distance in kilometers,
      // where value 1 represents storm in detector's near victinity, and 63 - very distant, out of range stroke
      // everything in between is just distance in kilometers
      int strokeDistance = AS3935.lightningDistanceKm();
      if (strokeDistance == 1)
      {
        Serial.println("Storm overhead, watch out!");
        lcdPosition(1,1);  
        Serial.println("Storm overhead");
        lcdPosition(1,3);  
        Serial.println("WATCH OUT!");
        counter=NoDetect;       
      }
        
      if (strokeDistance == 63)
      {
        Serial.println("Out of range lightning detected.");
        lcdPosition(0,2);  
        Serial.println("Out of range");
        lcdPosition(1,0);  
        Serial.println("lightning detect");
        counter=NoDetect;
      }
        
      if (strokeDistance < 63 && strokeDistance > 1)
      {
        Serial.print("Lightning detected ");
        Serial.print(strokeDistance,DEC);
        Serial.println(" kilometers away.");
        lcdPosition(1,0);  
        LCD.print("Distance: ");
        LCD.print(strokeDistance,DEC); 
        LCD.print("km");
        counter=NoDetect; 
      }
    }
}

 

the error

Arduino: 1.6.9 (Windows 10), Placa:"Arduino Uno"

Lightining:65: error: no matching function for call to 'AS3935::AS3935(byte (&)(byte), int, int)'

 AS3935 AS3935(SPItransfer,3,2); //change to AS3935(SPITransfer,9,3) if using slot #2

                              ^

In file included from C:\Users\pedro\OneDrive\Ambiente de Trabalho\Sketch FT1324M (2)\Sketch\Lightining\Lightining.ino:28:0:

C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\AS3935\src/AS3935.h:43:2: note: candidate: AS3935::AS3935()

  AS3935(void);

  ^~~~~~

C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\AS3935\src/AS3935.h:43:2: note:   candidate expects 0 arguments, 3 provided

C:\Users\pedro\OneDrive\Ambiente de Trabalho\Sketch FT1324M (2)\Sketch\Lightining\Lightining.ino: In function 'void setup()':

Lightining:92: error: 'class AS3935' has no member named 'reset'; did you mean 'regInt'?

   AS3935.reset();

          ^~~~~

          regInt

Lightining:94: error: 'class AS3935' has no member named 'setOutdoors'; did you mean 'setIndoor'?

   AS3935.setOutdoors();

          ^~~~~~~~~~~

          setIndoor

Lightining:95: error: 'class AS3935' has no member named 'registerWrite'; did you mean 'setRegisterBit'?

   AS3935.registerWrite(AS3935_NF_LEV,2);  //write 2 in the Noise Level register

          ^~~~~~~~~~~~~

          setRegisterBit

Lightining:95: error: 'AS3935_NF_LEV' was not declared in this scope

   AS3935.registerWrite(AS3935_NF_LEV,2);  //write 2 in the Noise Level register

                        ^~~~~~~~~~~~~

C:\Users\pedro\OneDrive\Ambiente de Trabalho\Sketch FT1324M (2)\Sketch\Lightining\Lightining.ino:95:24: note: suggested alternative: 'AS3935_H'

   AS3935.registerWrite(AS3935_NF_LEV,2);  //write 2 in the Noise Level register

                        ^~~~~~~~~~~~~

                        AS3935_H

Lightining:104: error: 'class AS3935' has no member named 'registerRead'; did you mean 'regDistance'?

   tunecap=AS3935.registerRead(AS3935_TUN_CAP);  //Internal calibration

                  ^~~~~~~~~~~~

                  regDistance

Lightining:104: error: 'AS3935_TUN_CAP' was not declared in this scope

   tunecap=AS3935.registerRead(AS3935_TUN_CAP);  //Internal calibration

                               ^~~~~~~~~~~~~~

C:\Users\pedro\OneDrive\Ambiente de Trabalho\Sketch FT1324M (2)\Sketch\Lightining\Lightining.ino:104:31: note: suggested alternative: 'AS3935_VERSION'

   tunecap=AS3935.registerRead(AS3935_TUN_CAP);  //Internal calibration

                               ^~~~~~~~~~~~~~

                               AS3935_VERSION

Lightining:114: error: 'class AS3935' has no member named 'enableDisturbers'; did you mean 'setMaskDisturber'?

   AS3935.enableDisturbers();

          ^~~~~~~~~~~~~~~~

          setMaskDisturber

C:\Users\pedro\OneDrive\Ambiente de Trabalho\Sketch FT1324M (2)\Sketch\Lightining\Lightining.ino: In function 'void printAS3935Registers()':

Lightining:158: error: 'class AS3935' has no member named 'getNoiseFloor'; did you mean 'setNoiseFloor'?

   int noiseFloor = AS3935.getNoiseFloor();

                           ^~~~~~~~~~~~~

                           setNoiseFloor

Lightining:159: error: 'class AS3935' has no member named 'getSpikeRejection'; did you mean 'setSpikeRejection'?

   int spikeRejection = AS3935.getSpikeRejection();

                               ^~~~~~~~~~~~~~~~~

                               setSpikeRejection

Lightining:160: error: 'class AS3935' has no member named 'getWatchdogThreshold'

   int watchdogThreshold = AS3935.getWatchdogThreshold();

                                  ^~~~~~~~~~~~~~~~~~~~

C:\Users\pedro\OneDrive\Ambiente de Trabalho\Sketch FT1324M (2)\Sketch\Lightining\Lightining.ino: In function 'void AS3935Irq()':

Lightining:189: error: 'class AS3935' has no member named 'interruptSource'; did you mean 'interruptHandler'?

     int irqSource = AS3935.interruptSource();

                            ^~~~~~~~~~~~~~~

                            interruptHandler

Lightining:208: error: 'class AS3935' has no member named 'lightningDistanceKm'; did you mean 'getDistance'?

       int strokeDistance = AS3935.lightningDistanceKm();

                                   ^~~~~~~~~~~~~~~~~~~

                                   getDistance

Foram encontradas múltiplas bibliotecas para «AS3935.h»
Utilizado: C:\Users\pedro\OneDrive\Documentos\Arduino\libraries\AS3935
Não utilizado: C:\Program Files (x86)\Arduino\libraries\AS3935
exit status 1
no matching function for call to 'AS3935::AS3935(byte (&)(byte), int, int)'

Este relatório teria mais informação com a
opção «Mostrar mensagens detalhadas durante a
compilação» seleccionada nas Preferências.

Is that just a copy of the original code? If so, there is another file, SerLCD.ino that is also part of the sketch. Without that, you get many, many errors.

With all the files, it compiles just find for Uno for me. I would (again) suggest you upgrade the IDE to the latest (1.8.19?)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.