Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By forlotto
#53266 Very nice example I really liked all the comments made it tons easier to follow what was going on in the code. This is helpful for everyone trying to understand how this all works and the communications side of things is also excellent showing how to properly communicate in accordance with the datasheet. I really don't see that you left that much out in the way of the datasheet if I recall correctly but I do seem to remember there being an option for no resistors in the datasheet as well could be incorrect though been a little while since I've looked at it.

Seems like a lot of code at first look but very easy to follow needs little or no modification really because it does not just act it has also has the ability to teach as well. I would not worry so much on modification as you say people will modify to their hearts content or needs. What is important here is the lesson.

I do have one modification I would love to see to the post NOT the code that being a video of this thing working with your LED's in action!

Thanks,

forlotto
User avatar
By Electroguard
#54346 Nice going on the SPI front Ecoli-557 - I've got some chips coming on a slow boat from china.
In your port expander program I see where you define the port interrupt registers, but I don't see an interrupt instruction being used anywhere... are the triggered inputs being responded to by interrupt?


And speaking of inputs, trackerj, I followed your links for the i2c port expander articles with great interest cos I've already got some of those. But I couldn't find anything about using the ports as inputs even though presumably that's what the "8 x independent switches implementation" should be about... but unfortunately from what I could see it just seems to be a repeat of the "outputs" article - so thought I should mention it.



If anyone has already used spi or i2c to give ESP_Basic multiple analog inputs it would be a welcome time-saver?
User avatar
By trackerj
#54385 Hi Electroguard,

The both articles are related with OUTPUT only, indeed, but is not the same thing twice at all.

One article is about how to implement a 8 way mutually exclussive switch and the other one is a 8 x independent switches implementation.

PCF8574 Input example will follow also but need some free time to polish it a bit before releasing. Meanwhile you can take a look at the PCF8574 input article done for LUA implementation, theory behind and reading inputs process are the same.

Happy breadboarding,
TJ.
User avatar
By Ecoli-557
#54386 Electroguard-
You can get interrupts several ways but to fully understand you have to consult the datasheet (48 pages).
I have successfully used the output of the chip into the ESP but you have to read the register in order to reset the interrupt output.
There are also 2 other registers noteworthy and probably useful; I called them INTFA and INTFB which are the interrupt FLAG registers - they tell you which pin caused the interrupt otherwise you can use INTCAPA and INTCAPB.

It is a great chip I have used before - getting it to live happily here with a ESP takes some bit-banging. I have been working with Mike on some tweaks for his SPI functions and if they work as planned will be of an enormous help for those of us who work in SPI which is faster than I2C and is full-duplex.

Not quite what Sumotoy has done with his libraries, but there is only so much memory the ESP can address for its OS and I think Mike is doing a great job with such little memory.

Regards.