mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
26 lines
479 B
Lua
26 lines
479 B
Lua
|
-- eLua test
|
||
|
|
||
|
if pd.name() == "AT91SAM7X" then
|
||
|
ledpin = pio.PB_20
|
||
|
elseif pd.name() == "LM3S" then
|
||
|
ledpin = pio.PF_0
|
||
|
else
|
||
|
ledpin = pio.P9_0
|
||
|
end
|
||
|
|
||
|
function cycle()
|
||
|
pio.set( ledpin )
|
||
|
tmr.delay( tmr.TMR0, 500000 )
|
||
|
pio.clear( ledpin )
|
||
|
tmr.delay( tmr.TMR0, 500000 )
|
||
|
end
|
||
|
|
||
|
pio.output( ledpin )
|
||
|
print( "Hello from eLua on " .. pd.name() )
|
||
|
print "Watch your LED blinking :)"
|
||
|
print "Press any key to end this demo.\n"
|
||
|
|
||
|
while uart.recv( uart.UART0, 0, 0 ) < 0 do
|
||
|
cycle()
|
||
|
end
|