code for ex 6 (does not work at present due to piezo being disabled for johnny-five)