2008-08-06 15:26:25 +00:00
|
|
|
-- eLua test
|
|
|
|
|
2008-08-27 20:05:09 +00:00
|
|
|
if pd.board() == "SAM7-EX256" then
|
2008-08-06 15:26:25 +00:00
|
|
|
ledpin = pio.PB_20
|
2008-08-27 20:05:09 +00:00
|
|
|
elseif pd.board() == "EK-LM3S8962" or pd.board() == "EK-LM3S6965" then
|
2008-08-06 15:26:25 +00:00
|
|
|
ledpin = pio.PF_0
|
2008-09-01 20:32:43 +00:00
|
|
|
elseif pd.board() == "STR9-COMSTICK" then
|
2008-08-06 15:26:25 +00:00
|
|
|
ledpin = pio.P9_0
|
2008-09-01 20:32:43 +00:00
|
|
|
elseif pd.board() == "LPC-H2888" then
|
|
|
|
ledpin = pio.P2_1
|
2008-08-09 10:46:23 +00:00
|
|
|
else
|
2008-09-01 20:32:43 +00:00
|
|
|
print( "\nError: Unknown board " .. pd.board() .. " !" )
|
2008-08-09 10:46:23 +00:00
|
|
|
return
|
2008-08-06 15:26:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function cycle()
|
|
|
|
pio.set( ledpin )
|
2008-08-27 20:05:09 +00:00
|
|
|
tmr.delay( 0, 500000 )
|
2008-08-06 15:26:25 +00:00
|
|
|
pio.clear( ledpin )
|
2008-08-27 20:05:09 +00:00
|
|
|
tmr.delay( 0, 500000 )
|
2008-08-06 15:26:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
pio.output( ledpin )
|
2008-08-09 11:15:39 +00:00
|
|
|
print( "Hello from eLua on " .. pd.cpu() )
|
2008-08-06 15:26:25 +00:00
|
|
|
print "Watch your LED blinking :)"
|
|
|
|
print "Press any key to end this demo.\n"
|
|
|
|
|
2008-08-27 20:05:09 +00:00
|
|
|
while uart.recv( 0, 0, 0 ) < 0 do
|
2008-08-06 15:26:25 +00:00
|
|
|
cycle()
|
|
|
|
end
|