embeddedadventures / MOD-1016

Source and examples for talking to the MOD-1016 AS3935 lightning sensor module
http://www.embeddedadventures.com/as3935_lightning_sensor_module_mod-1016.html
13 stars 6 forks source link

No I2C comunnication .. #2

Closed golvellius closed 8 years ago

golvellius commented 8 years ago

Hi ...

I am using mod-1016 with this library but not working with I2c config ...

If i used the module as a SPI( desoldering ...etc ) and converting it works ... but when i put module in i2c its not working ...

Here is the code i am using to I2C ; ...... void setup() { Serial.begin(9600); while (!Serial) {} Serial.println("Welcome to the MOD-1016 (AS3935) Lightning Sensor test sketch!"); Serial.println("Embedded Adventures (www.embeddedadventures.com)\n");

//I2C Wire.begin(); mod1016.init(IRQ_PIN); //SPI //SPI.begin(); //mod1016.init(IRQ_PIN, CS_PIN);

//Tune Caps, Set AFE, Set Noise Floor autoTuneCaps(IRQ_PIN);

//mod1016.setTuneCaps(7); mod1016.setOutdoors(); mod1016.setNoiseFloor(5); ......

I have used i2c scanner and it get the module at address 0x03 ... so module works.

Maybe code error ? Thanks a lot ...

golvellius commented 8 years ago

Hi ...

I have test and maybe it's a problem in the code when using i2c ..

in as3935.h you have not defined variable default value bool_usingI2C You have to change with (bool_usingI2C = true) as TRUE ... then when using I2C always use the code as I2C and when using SPI you change the default value in the code as false ... Please check it now the system is working in I2C configuration .. NOT TESTED IN SPI .

thanks

dr4nc3s commented 8 years ago

Yes, thank you for that! Made the change and tested SPI and I2C. :)