first version of swimming sensor code