JavaScript file for Hall Effect sensor (magnet sensor)