As the title says... Chat on...

User avatar
By Chumanist
#22541 Something doesn't work:
Code: Select allSENT: local mode, write, OUTPUT = gpio.mode, gpio.write, gpio.OUPUT
SENT: mode(7,OUTPUT)
SENT: for i=1 to 100000 do
SENT: write(7,1)
SENT: write(7,0)
SENT: end
local mode, write, OUTPUT = gpio.mode, gpio.write, gpio.OUPUT
> mode(7,OUTPUT)
stdin:1: attempt to call global 'mode' (a nil value)
> for i=1 to 100000 do
stdin:1: ',' expected near 'to'
> write(7,1)
stdin:1: attempt to call global 'write' (a nil value)
> write(7,0)
stdin:1: attempt to call global 'write' (a nil value)
> end
stdin:1: '<eof>' expected near 'end'
>
User avatar
By GerryKeely
#22587 Hi
Try this
Code: Select alllocal mode, write, OUTPUT = gpio.mode, gpio.write, gpio.OUTPUT
mode(7,OUTPUT)
for i=1,100000 do
write(7,1)
write(7,0)
end


save it as a lua file and run it using dofile("filename.lua")

Changes from your program are
gpio.OUTPUT instead of gpio.OUPUT
for i = 1 ,1000000 instead of for i = 1 to 1000000

Lua may be slower than other platforms as it is an interpreted language.

regards

Gerry