Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 11:362594298828, committed 2019-01-14
- Comitter:
- bmichael21
- Date:
- Mon Jan 14 05:01:00 2019 +0000
- Parent:
- 10:f427bdd495ac
- Child:
- 13:7933a0c345b4
- Commit message:
- fix syntax errors
Changed in this revision
--- a/main.cpp Mon Jan 14 04:26:11 2019 +0000
+++ b/main.cpp Mon Jan 14 05:01:00 2019 +0000
@@ -11,12 +11,13 @@
#include "servo.h"
#include "display.h"
+Serial pc(USBTX, USBRX);
DigitalOut myled(LED1);
int main() {
servoInit();
-
while(true) {
+ pc.printf("temp1: %f temp2: %f\r\n", temp1, temp2);
updateTempDifference();
//display here
moveServo();
--- a/servo.cpp Mon Jan 14 04:26:11 2019 +0000
+++ b/servo.cpp Mon Jan 14 05:01:00 2019 +0000
@@ -14,10 +14,10 @@
void moveServo(){
if(curDiff < prevDiff)
curDirection = !curDirection; //turn the other way- progress is being lost
- if(direction == 1 && curDutyCycle < 2400)//inputting numbers greater than 2400(90 degrees) or less than 600(-90 degrees) causes unpredictable behaviour
- curDutyCycle++; //+1 = +0.1 degrees
- else if(direction == 0 && curDutyCycle > 600)
- curDutyCycle--;
+ if(curDirection == 1 && curDutyCycle < 2400)//inputting numbers greater than 2400(90 degrees) or less than 600(-90 degrees) causes unpredictable behaviour
+ curDutyCycle += 10; //+10 = +1 degree
+ else if(curDirection == 0 && curDutyCycle > 600)
+ curDutyCycle -= 10;
servo.pulsewidth_us(curDutyCycle);
}
--- a/servo.h Mon Jan 14 04:26:11 2019 +0000 +++ b/servo.h Mon Jan 14 05:01:00 2019 +0000 @@ -5,6 +5,6 @@ extern PwmOut servo; void servoInit(); -void moveServo(float tempDiff); +void moveServo(); #endif \ No newline at end of file
--- a/tempSnsr.cpp Mon Jan 14 04:26:11 2019 +0000
+++ b/tempSnsr.cpp Mon Jan 14 05:01:00 2019 +0000
@@ -3,7 +3,7 @@
AnalogIn tempSnsr1(p16);
AnalogIn tempSnsr2(p17);
-float curdiff, temp1, temp2, prevDiff;
+float curDiff, temp1, temp2, prevDiff;
float highTemp(){ //this function used for display information. Temperatures not updated here to avoid changing values in the middle
//of the while true loop in main.
--- a/tempSnsr.h Mon Jan 14 04:26:11 2019 +0000 +++ b/tempSnsr.h Mon Jan 14 05:01:00 2019 +0000 @@ -4,6 +4,10 @@ extern AnalogIn tempSnsr1; extern AnalogIn tempSnsr2; +extern float curDiff; +extern float prevDiff; +extern float temp1; +extern float temp2; float highTemp(); void avgTemps();
