Sample code of a Duff device