code for sensing intervals