Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By Fadi
#2249 Hi Community.

I am having a bit of trouble identifying the proper way to initialize and define GPIO pins on the ESP8266.
Looking at http://g-lab.ca/esp8266ex-gpio-applicat ... interface/
which takes an excerpt from the documentation, I am at total loss. should we use BIT2 for GPIO2? or just the number 2 when for instance
reading GPIO_INPUT_GET().

can someone shed some light on how to properly init those pins.
an example of INPUT and OUTPUT pins (say GPIO2 or GPIO1) would be great.

Thanks
FK
User avatar
By cendev
#2250 feuw.. i knew i saw smthng like that :)

i dunno if this is what you are looking for but i guess both rudi,richard and mamalala's posts are usefull :) here mamalala posted a firmware source which is like arduino blink :) i was lookin for this for hours...

there is a firmware on electrodragons site but that one is only compiled bins.. :) no source, you can enable/disable changing pin states over tcp by an it command

whatever :) take a look at this :)
viewtopic.php?f=5&t=8&start=20
User avatar
By Fadi
#2251 Thanks for the quick reply.
I do appreciate your help and will definitely take another look at that thread as I might have skimmed it a little too quickly.
But I still feel the SDK and documentation is lacking, perhaps it is the language barrier, perhaps rushing to make this available to us publicly (which is appreciated none the less).
I wish I could find a good reference and documentation to read which gives me an understanding of how to tweak and change things.

Some other examples to show what I mean, until now, I have not found any documentation stating the GPIO pins and their muxed operations.
i.e, UART1 Tx and Rx are which GPIOs? maybe I am tired of spending two nights debugging booting issues only to find out that you need to pull up/down the pins
in a certain way other than what is stated on most blogs. anyhow, this chip has potential and we should not rest until we make it as easy to use as possible for the community.

FK
User avatar
By cendev
#2253 I completely agree with you.. It's been nearly 30 hours since i sat down on this chair and nearly 70% of this time spent on reading the same subjects over and over or trying to find a nice documentation... I can describe myself as a novice c programmer and while starting with a subject like this is hard, its even more painful to try to accomplish something without proper documentation... As i said before i was looking for something similar and the most helpful thing i found is on the last page of that topic.

mcsa wrote:I write example that toggle GPIO via TCP, based on GPIO2 example.
Iis operate GPIO 0,2,12,13,14,16 (all gpio on esp-03)
I am new newbie in C, and code may look strange.
Link to SRC and firmware https://drive.google.com/file/d/0B3aO1G ... sp=sharing

when module power-on it start TCP server on port 9999, TCP comands:
GPIO,NN,state - switch gpio number NN to state "state", ex GPIO,00,1 - set GPIO1 to 1 or GPIO,16,0 - set GPIO16 to 0
GPIO,NN - read gpio number NN state, ex GPIO,00 or GPIO,12

PS I found that only gpio00 and gpio02 work, other always in high state. trying to solve the problem
PS I resolve problem, now working GPIO 0,2,12,13,14. files updated


the source mcsa shared with us may contain something useful i hope. I know it's the second time i've posted the same topic but there will be more who will looking for even a clue :) I hope this will help you, me or others :) btw thx mcsa ;)