I've made an esp8266 driver for the HC-SR04 ultrasonic sensor: https://github.com/eadf/esp8266_ping
It uses two, user defined, pins for the sensor. As such it seems to work fine (at least under sdk 0.9.4)
I've seen that the arduino libraries are able to use just one pin for this sensor - basically trigger and echo are wired together. And that's where i got a problem. The HC-SR04 is a 5V device, so i use a level shifter to protect the esp.
It seems like level shifter prevents the HC-SR04 from working in single pin mode. When i wire the pins together the 5V side (HC-SR04) is a flat line (low). - Yes: the esp has disabled output after the inital pulse.
Arduino one pin:
Esp two pins (i need to merge these pins to one)
Could anyone of you help me with this small (electrical?) problem?
I jut got an idea.. maybe i instead should wire the pins together at the 3V3 side..
http://elinux.org/RPi_GPIO_Interface_Circuits#Level_Shifters