Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Softwarewire #82

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Softwarewire #82

wants to merge 12 commits into from

Conversation

finitespace
Copy link
Owner

Related issue # and issue behavior

A request was made to add SoftwareWire to the library. #79

Description of changes/fixes

Added BME280I2CSoftwareWire.h/cpp. Added Config.h

@mention a person to review

@daniu-de, please review the functionality of the new additions.

Steps to test

Uncomment line 32 in Config.h: #define USING_SOFTWARE_WIRE 1
Build and run the BME_280_I2C_SoftwareWire_Test.ino sketch on a live setup.

Any outstanding TODOs or known issues

Needs testing.

@finitespace
Copy link
Owner Author

TODO: Update documentation.

@daniu-de
Copy link

daniu-de commented Mar 14, 2018

Hi,
THANKS A LOT!!!!

unfortunately I am getting a compilation error:
BME_280_I2C_SoftwareWire_Test.ino: In function ‘void setup()’:
BME_280_I2C_SoftwareWire_Test.ino:37:9: error: no match for ‘operator!’ (operand type is ‘TinyDebugSerial’)
BME_280_I2C_SoftwareWire_Test.ino:37:9: note: candidate is:
BME_280_I2C_SoftwareWire_Test.ino:37:9: note: operator!(bool)
BME_280_I2C_SoftwareWire_Test.ino:37:9: note: no known conversion for argument 1 from ‘TinyDebugSerial’ to ‘bool’

However I am pretty sure that I cannot properly test it this way because I do not know how to connect the sensor directly to the raspberry and see no way to see the print output - I am using tinytx3 nodes - originally created by Nathan Chantrell and I need a RFM69CW module which sends the sensor data to a receiver which is connected to a raspberry pi. This way I can read the sensor data with a raspberry pi. I got a working Sketch for HTU21D sensor which I will change so that it sends the data of a BME280.

When I succeed to make it send the data I can post the working sketch.

At the moment my sketch gives me the following error:
/root/sketchbook/libraries/BME280/BME280.cpp:31:18: fatal error: Wire.h: Datei oder Verzeichnis nicht gefunden
#include <Wire.h>

which surprises me since Wire.h should be in the path. However I am also not sure that it is right that the sketch is asking for Wire.h

Removing old #include <Wire.h> include.
@finitespace
Copy link
Owner Author

@daniu-de, what compiler/settings are you using to compile this?

The first error is because the !Serial is not supported for TinyDebugSerial. You can probably just delete line 42.

#include <Wire.h> is old code from the original version 1.0, I have removed it and committed. I was not able to compile it yet though. I will compile it when I am hope tonight (I don't think it should cause any issues).

@daniu-de
Copy link

Hi,
hmmm ... not sure about the settings. I use arduino IDE set to attiny84 with 1Mhz

The #include Wire.h is also in BMEI2C.cpp and by commenting out this line I get:

/root/sketchbook/libraries/BME280/BME280I2C.cpp: In member function ‘virtual bool BME280I2C::WriteRegister(uint8_t, uint8_t)’:
/root/sketchbook/libraries/BME280/BME280I2C.cpp:71:3: error: ‘Wire’ was not declared in this scope
Wire.beginTransmission(m_settings.bme280Addr);
^
/root/sketchbook/libraries/BME280/BME280I2C.cpp: In member function ‘virtual bool BME280I2C::ReadRegister(uint8_t, uint8_t*, uint8_t)’:
/root/sketchbook/libraries/BME280/BME280I2C.cpp:90:3: error: ‘Wire’ was not declared in this scope
Wire.beginTransmission(m_settings.bme280Addr);

@finitespace
Copy link
Owner Author

I have committed some changes that should fix the wire includes.

@daniu-de
Copy link

Hi,
sorry - I still got a problem:
BME_280_I2C_SoftwareWire_Test.ino: In function ‘void setup()’:
BME_280_I2C_SoftwareWire_Test.ino:37:9: error: no match for ‘operator!’ (operand type is ‘TinyDebugSerial’)
BME_280_I2C_SoftwareWire_Test.ino:37:9: note: candidate is:
BME_280_I2C_SoftwareWire_Test.ino:37:9: note: operator!(bool)
BME_280_I2C_SoftwareWire_Test.ino:37:9: note: no known conversion for argument 1 from ‘TinyDebugSerial’ to ‘bool’

(that is your sketch)

mine shows the follwing error in this line:
->SoftwareWire softwareWire(SDA, SCK);
BME280I2CSoftwareWire bme(softwareWire);

Error:
/usr/share/arduino/Send_BME280_n.ino:104: undefined reference to `BME280I2CSoftwareWire::BME280I2CSoftwareWire(SoftwareWire&, BME280I2C::Settings const&)'

@daniu-de
Copy link

Another issue I am having with my own sketch is:
/usr/lib/gcc/avr/4.9.2/../../../avr/bin/ld: Send_BME280_n.cpp.elf section .text' will not fit in region text'
/usr/lib/gcc/avr/4.9.2/../../../avr/bin/ld: region `text' overflowed by 1408 bytes

Is it possible that BME280 like that uses up a bit much memory?

@finitespace
Copy link
Owner Author

Sketch uses 3308 bytes (40%) of program storage space. Maximum is 8192 bytes.
Global variables use 153 bytes (29%) of dynamic memory, leaving 359 bytes for local variables. Maximum is 512 bytes.

I was able to compile the example for Attiny84 after commenting out the Serial calls.

Attiny does not support the "Serial" library, so those calls will have to be removed.

Error:
/usr/share/arduino/Send_BME280_n.ino:104: undefined reference to `BME280I2CSoftwareWire::BME280I2CSoftwareWire(SoftwareWire&, BME280I2C::Settings const&)'

Is because you need to modify the "Config.h" file to #define USING_SOFTWARE_WIRE 1 and make sure all other defines in the file are commented out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants