2018-02-19 19:35:32 +00:00
|
|
|
% This is a sample script that disables the UART and uses GPIO 1 and GPIO 3
|
|
|
|
% as normal digital I/O pins (useful e.g. on a ESP01)
|
|
|
|
|
2018-02-11 09:09:03 +00:00
|
|
|
% Config params, overwrite any previous settings from the commandline
|
2018-02-19 19:35:32 +00:00
|
|
|
% disable all output on the UART
|
2018-02-11 09:09:03 +00:00
|
|
|
config system_output 0
|
|
|
|
|
2018-02-19 19:35:32 +00:00
|
|
|
% Now the initialization, this is done once after booting
|
2018-02-11 09:09:03 +00:00
|
|
|
on init
|
|
|
|
do
|
|
|
|
gpio_pinmode 1 input pullup
|
|
|
|
gpio_pinmode 3 input pullup
|
|
|
|
|
2018-02-19 19:35:32 +00:00
|
|
|
% Now the events, checked whenever something happens
|
2018-02-11 09:09:03 +00:00
|
|
|
on gpio_interrupt 1 pullup
|
|
|
|
do
|
|
|
|
println "Interrupt GPIO 1: " | $this_gpio
|
|
|
|
|
|
|
|
on gpio_interrupt 3 pullup
|
|
|
|
do
|
|
|
|
println "Interrupt GPIO 3: " | $this_gpio
|