something like this will get you started.
as an added feature it stops the annoying rapid fire
when using a simple command like
if inkey$()="n" then gosub wrong
sync on
sync rate 0
make object cube 1,10
ink rgb(255,255,255),1
do
rem scancode of (n) is 49
If keystate(49)=1 and MYswitchNAME_switch=0
MYswitchNAME_toggle=1-MYswitchNAME_toggle
MYswitchNAME_switch=1
text 10,30,"switch off"
endif
If keystate(49)=0 then MYswitchNAME_switch=0
if MYswitchNAME_toggle = 1
text 10,30,"switch on"
rem add your gosub here
endif
text 10,10,"scancode :"+STR$(scancode())
sync
loop