Difference between revisions of "GPIO"

From Let's Control It
Jump to navigation Jump to search
Line 18: Line 18:
 
We can control the pin with simple http url commands. To change the pin to high or low steady output:
 
We can control the pin with simple http url commands. To change the pin to high or low steady output:
  
<nowiki>http://<ESP IP address>/control?cmd=GPIO,<pin>,0</nowiki>
+
'''<nowiki>http://<ESP IP address>/control?cmd=GPIO,<pin>,0</nowiki>'''
  
<nowiki>http://<ESP IP address>/control?cmd=GPIO,<pin>,1</nowiki>
+
'''<nowiki>http://<ESP IP address>/control?cmd=GPIO,<pin>,1</nowiki>'''
  
  
 
To set a certain PWM level:
 
To set a certain PWM level:
  
<nowiki>http://<ESP IP address>/control?cmd=PWM,<pin>,<level></nowiki>
+
'''<nowiki>http://<ESP IP address>/control?cmd=PWM,<pin>,<level></nowiki>'''
  
  
 
To send a pulse to a certain pin:
 
To send a pulse to a certain pin:
  
<nowiki>http://<ESP IP address>/control?cmd=Pulse,<pin>,<state>,<duration></nowiki>
+
'''<nowiki>http://<ESP IP address>/control?cmd=Pulse,<pin>,<state>,<duration></nowiki>'''
  
 
Example to send an active high pulse on GPIO 2 for 500 mSeconds:
 
Example to send an active high pulse on GPIO 2 for 500 mSeconds:
  
<nowiki>http://<ESP IP address>/control?cmd=Pulse,2,1,500</nowiki>
+
'''<nowiki>http://<ESP IP address>/control?cmd=Pulse,2,1,500</nowiki>'''
  
 
== ESP Connexio ==
 
== ESP Connexio ==

Revision as of 17:48, 2 October 2015

Introduction

The ESP module can control things with it's build-in GPIO output pins. We can turn these on or off or we can set these pins to a special Pulse modulated value (PWM output). And it's also possible to send short pulses (single puls) to one of these pins to control specific devices that are switched with a single short high or low signal.

Hardware

It's best to connect a LED to the GPIO to test your setup. You could dim this LED with the PWM mode commands.


LED.png


Software

Custom Sketch

ESP Easy

We do not have to select a task to control basic GPIO output.

We can control the pin with simple http url commands. To change the pin to high or low steady output:

http://<ESP IP address>/control?cmd=GPIO,<pin>,0

http://<ESP IP address>/control?cmd=GPIO,<pin>,1


To set a certain PWM level:

http://<ESP IP address>/control?cmd=PWM,<pin>,<level>


To send a pulse to a certain pin:

http://<ESP IP address>/control?cmd=Pulse,<pin>,<state>,<duration>

Example to send an active high pulse on GPIO 2 for 500 mSeconds:

http://<ESP IP address>/control?cmd=Pulse,2,1,500

ESP Connexio