Modified script to poll SAM3