what is wrong with this code?

Ok so, you need to put the code inside a device class kinda like this