This might be quite useful. A key that can be programmed to change colours when turning and enter a colour-dependent phrase when pressed:
while true do
x=rot.pos()
i=x/4%8+1
pressed=sw.get()
if i==1 then led.rgb(1.0,0.0,0.0) if pressed then hid.hit("red") end
elseif i==2 then led.rgb(0.0,1.0,0.0) if pressed then hid.hit("green") end
elseif i==3 then led.rgb(0.0,0.0,1.0) if pressed then hid.hit("blue") end
elseif i==4 then led.rgb(1.0,1.0,0.0) if pressed then hid.hit("yellow") end
elseif i==5 then led.rgb(0.0,1.0,1.0) if pressed then hid.hit("cyan") end
elseif i==6 then led.rgb(1.0,0.0,1.0) if pressed then hid.hit("purple") end
elseif i==7 then led.rgb(1.0,0.5,0.5) if pressed then hid.hit("pink") end
elseif i==8 then led.rgb(1.0,1.0,1.0) if pressed then hid.hit("white") end
end
if pressed then
while sw.get() do end
end
end
... of course instead of writing the colour name, one could start applications, enter passwords (not really save though...), etc.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.