Thi is a functioning Drawbridge.
Before you can use it after you have pasted it in you will need to place redstone on the blue clay block, See in picture.
This was built in 1.10.2 so may not work in other versions properly.
This was inspired by CalamityGreen's Oakheart Castle 2, ypu can probably paste this strait over this build. Apologies CalamityGreen for using some of your build.