Benoit Moreau
/
Servo_Temp
Servo that moves based on temperature readings from a thermistor
Revision 3:1dd8980f5f07, committed 2019-11-13
- Comitter:
- aahnothebees
- Date:
- Wed Nov 13 17:11:08 2019 +0000
- Parent:
- 2:319ee9815aba
- Commit message:
- take 2;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 13 17:02:21 2019 +0000 +++ b/main.cpp Wed Nov 13 17:11:08 2019 +0000 @@ -16,7 +16,7 @@ y = (((0.3*tempurature) + 3)/100); //formula that converts the temperature measured by the thermistor into an equivalent duty-cycle, in order for the servo to display an accurate 1:1 scale, change the constant from 0.3 to 0.05 servo.period(0.02); // sets the period of the servo PWM to 20 ms as specifed in lesson 7 servo.write(y); //writes the calculated duty-cycle to the servo - bite=((28.333333333333*y)-85); + bite=((28.333333333333*(y*100))-85); printf("The tempurature is: %f\n",tempurature);//prints the temperature in celcius to the serial terminal wait(0.5); //waits for half a second before running the next iteration }