I've been worried about the programming aspects of this project. I can modify existing code, but I have trouble if my goal is too different from the code I'm trying to modify. But instead of trying to do everything at once, I set the goal of just making the servo respond to the temperature sensor in some way.
I succeeded! Since any temperature I'm likely to get will be between 0-100 degrees Celsius, and since the servo moves between 0-180 degrees of rotation, I simply set the servo to move to whatever temperature is read! Since the air temperature is relatively constant, the servo doesn't move much at all. It stays at about 20 degrees. When I vary the temperature by a small amount by warming the sensor with my fingers, the servo moves a small amount. This is great, because I don't want it moving all over the place when I'm taking a shower. I may be able to optimize for power consumption by having a dampening system or something, but for now my next step is to wrap my head around how to make it compensate for a change in temperature rather than echo the change in temperature.
My initial thought is to have variables for "temperature we want" and "temperature detected" and have the servo move until they're the same. I'll try that.
No comments:
Post a Comment