i don't understand the programming examples as light switchs
Have you read the documentation for the mesh sdk?