Skip to content

New combined demo showing most non I2C input sensors. #6

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

Merged
merged 8 commits into from
Jan 13, 2021

Conversation

marcmerlin
Copy link
Contributor

It'd be great to query I2C too, but those sensors unfortunately
are not setup to use a different I2C address and conflict with
one another unless you put some solder bridges to change the address

It'd be great to query I2C too, but those sensors unfortunately
are not setup to use a different I2C address and conflict with
one another unless you put some solder bridges to change the address
marcmerlin added a commit to marcmerlin/Arduino_SensorKit that referenced this pull request Dec 17, 2020
I unfortunately wasted 1H trying to use the oled due to this example.
Display lines need to be 9, 18, 27, 36, 45, 54
Using 33 is not good, it's an incorrect value that ends up in the wrong place, and gives the
impression that you can give any Y coordinate, when in fact you cannot.
If you don't, text gets overlayed on top of other text, even though it shouldn't according to Y

See arduino-libraries#6 for an example.
@marqdevx
Copy link
Member

Are you using the version 1.0.5?
If you are not, please update the library :) and try if you can use both at the same time, thanks!

Oled.setFlipMode(true);

// Enabling any of those 2 stops the OLED from working
//Accelerometer.begin();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marqdevx enabling any of those 2 lines with library 1.0.5, stops the OLED from working.

@marcmerlin
Copy link
Contributor Author

correct, I have 1.0.5. See line 75/76 in https://github.com/arduino-libraries/Arduino_SensorKit/pull/6/files
I did run the I2C scanner, and indeed all 3 devices have different addresses

@marcmerlin
Copy link
Contributor Author

Without looking in details, is it an issue that your base library does not give I2C addresses for the sensors, and they get auto detected if you use one at a time, but if you use 2 or 3 of them the autodetection fails. However if you were to hardcode the addresses, then they would work at the same time?

@marqdevx
Copy link
Member

The sensors and the display have a default address, as far as I know only the display's address can be changed.
What do you mean by autodetection fails?

I can use them at the same time

@marcmerlin
Copy link
Contributor Author

@marqdevx : since the hardware addresses do not conflict (I was afraid they did, but I2C scan shows they don't), that part is not an issue.
The sensors work if I use them separately, but they do not work if I use OLED + another one.

If you have a demo that uses all 3 sensors at the same time, please add it to this repo.
In the meantime, you can also look at this PR and/or download https://github.com/marcmerlin/Arduino_SensorKit/blob/Combined_Demo/examples/Combined_Demo/Combined_Demo.ino
For me, the moment I uncomment one of those, the OLED stops working:

  //Accelerometer.begin();
  //Pressure.begin();

I may be doing something wrong, in which case having a known good example, would be even more valuable.

@marcmerlin
Copy link
Contributor Author

Any update on this? I'd be happy to write a better combined demo for you, but I'd rather avoid wasting time debugging I2C issues if you already know what's going on

When pushing the button, output a tone.
@marcmerlin
Copy link
Contributor Author

i just added support for the buzzer and fixed cursor values for u8x8

When pushing the button, output a tone.
Show buzzer tone on screen.
@marcmerlin
Copy link
Contributor Author

And now it shows Hz value on screen and outputs that on the buzzer when pushed.

@marqdevx marqdevx added the type: enhancement Proposed improvement label Jan 11, 2021
@marcmerlin marcmerlin mentioned this pull request Jan 12, 2021
@marcmerlin
Copy link
Contributor Author

Thanks to #13 I can get all sensors working now.
Would you be ok merging this pull request?

@marcmerlin
Copy link
Contributor Author

PXL_20210112_234145790

@marqdevx
Copy link
Member

marqdevx commented Jan 13, 2021

@marcmerlin Could you have a look at the changes I made?

Basically I've just made it more easy to understand, cause the SensorKit its made for not that advanced users, it's nice if a non experience user can understand the flow of the program easily.

For example removing the uint8_t can cause doubts.

And thanks for the sketch, its working fine, and its super cool, good job :)

Have a nice one!

@marcmerlin
Copy link
Contributor Author

@marqdevx thanks for the code review and modifications.
you're better at making code for beginners than I am, everything you did makes sense.
The only thing is that I have a pet peeve against using int which is ultimately an unknown size (which arguably could be 8bits when you need 16, and often wastes 32bits when you only need 16 or 8), but I'll leave that one up to you.

I assume you tested the code after your modifications (I don't have my board next to me right now), and if so, seems fine to submit, thank you.

@marqdevx
Copy link
Member

Thanks, yes I get the point of the size, but at this level its not "important", its better to focus to cover a bigger range of user's knowledge.

Yes, I did and it works.

I will merge it and release a new version.

Thanks! Have a nice one 👍

@marqdevx marqdevx merged commit 1e9471c into arduino-libraries:main Jan 13, 2021
@marcmerlin
Copy link
Contributor Author

Great, thanks for your help and getting I2C to work for all the sensors at the same time.

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

Successfully merging this pull request may close these issues.

2 participants