2010-09-06 20:24:53 -05:00
|
|
|
package.cpath = "./?.so"
|
2010-09-06 21:25:51 -05:00
|
|
|
require "gpio"
|
2010-09-06 20:24:53 -05:00
|
|
|
|
2010-09-06 20:49:11 -05:00
|
|
|
PORT_A = 0
|
|
|
|
PORT_B = 1
|
|
|
|
PORT_C = 2
|
|
|
|
PORT_D = 3
|
|
|
|
|
2010-09-06 20:24:53 -05:00
|
|
|
function pulse()
|
2010-09-06 21:25:51 -05:00
|
|
|
gpio.set_pin(pio,17)
|
2010-09-06 20:24:53 -05:00
|
|
|
delay_s(1)
|
2010-09-06 21:25:51 -05:00
|
|
|
gpio.clear_pin(pio,17)
|
2010-09-06 20:24:53 -05:00
|
|
|
delay_s(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
function delay_s(delay)
|
|
|
|
delay = delay or 1
|
|
|
|
local time_to = os.time() + delay
|
|
|
|
while os.time() < time_to do end
|
|
|
|
end
|
|
|
|
|
2010-09-06 21:25:51 -05:00
|
|
|
pio=gpio.open_port(PORT_C)
|
|
|
|
gpio.gpio_as_output(pio,17)
|
2010-09-06 20:24:53 -05:00
|
|
|
|
|
|
|
for i=0,5,1 do
|
|
|
|
pulse()
|
|
|
|
end
|
|
|
|
|