Hi,
Thanks for replying. I am using an encoder as I didn't think a potentiometer would be accurate enough as I wanted precise positioning. I admit, as a newbie they are not the simplest, and I do not fully get everything the code does in relation to them, but as far as I can guess that bit is working fine, and functioning as intended.
I am using just one light sensor wired up and being read by an analog pin. As I have made a test rig for the setup I can easily control the amount of light to the sensor, but when it's live I think I will have two set up like a divider to make it less likely to trigger by things like car headlights going past.
Thanks for the advice, I will change the variables to be easier to understand and more descriptive, and I'll do a flowchart too.
The big issue and I can't get is the trigger. So I can get it to change the state to 'OPENING' when it gets light, but I don't know how to just do this just once. As when I then close it partly with the buttons it opens again because the light sensor logic is saying 'it's light, but the blinds aren't open, so set to 'OPENING' '. I would like help with the code needed to say ok its light, so open, but then don't try to open again until it has gone dark again first.
thanks
Tom