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 15:1eed07b5a5ba, committed 2019-01-14
- Comitter:
- bmichael21
- Date:
- Mon Jan 14 07:00:31 2019 +0000
- Parent:
- 14:5831b2b375e7
- Child:
- 16:58b9673e64d7
- Commit message:
- fixed everything
Changed in this revision
--- a/display.cpp Mon Jan 14 05:09:32 2019 +0000
+++ b/display.cpp Mon Jan 14 07:00:31 2019 +0000
@@ -2,22 +2,22 @@
#include "tempSnsr.h"
BusOut display(p5, p6, p7, p8, p9, p10, p11, p12);
-AnalogOut transistor1(p19);
-AnalogOut transistor2(p20);
+DigitalOut transistor1(p19);
+DigitalOut transistor2(p20);
-float dt = 0.01;
+float dt = .005;
void sevSegDisplay() {
-int firstNum = (highTemp() % 100) / 10; // Tens place digit for left seven segment display
-int secondNum = (highTemp() % 10); // ones place digit for right seven segment display
+int firstNum = (int)highTemp() % 100 / 10; // Tens place digit for left seven segment display
+int secondNum = (int)highTemp() % 10; // ones place digit for right seven segment display
+ display = sevenSegConvert(firstNum); // displays tens digit
transistor1 = 1; // turn on left display
- transistor2 = 0; // turn off right display
- display = sevenSegConvert(firstNum); // displays tens digit
wait(dt);
transistor1 = 0; // turn off left display
+ display = sevenSegConvert(secondNum); // displays ones digit
transistor2 = 1; // turn on right display
- display = sevenSegConvert(secondNum); // displays ones digit
wait(dt);
+ transistor2 = 0; // turn off right display
}
int sevenSegConvert(int n) { // translates temperature number to seven segment display LEDs
@@ -35,4 +35,5 @@
case 9: code = 0x6F; break;
default: code = 0x00;
}
- return code;
\ No newline at end of file
+ return code;
+ }
\ No newline at end of file
--- a/display.h Mon Jan 14 05:09:32 2019 +0000 +++ b/display.h Mon Jan 14 07:00:31 2019 +0000 @@ -0,0 +1,2 @@ +void sevSegDisplay(); +int sevenSegConvert(int n); \ No newline at end of file
--- a/servo.cpp Mon Jan 14 05:09:32 2019 +0000 +++ b/servo.cpp Mon Jan 14 07:00:31 2019 +0000 @@ -1,7 +1,7 @@ #include "servo.h" #include "tempSnsr.h" -PwmOut servo(p24); +PwmOut servo(p23); int curDutyCycle = 1500; //1500 corresponds to zero degrees with a change of 10 changing the value by one degree bool curDirection = 0; //the direction the servo moved last. the actual direction doesn't matter, we just continue or turn around
--- a/tempSnsr.cpp Mon Jan 14 05:09:32 2019 +0000
+++ b/tempSnsr.cpp Mon Jan 14 07:00:31 2019 +0000
@@ -20,8 +20,8 @@
temp1 += tempSnsr1;
temp2 += tempSnsr2;
}
- temp1 = (temp1 * 10 * 3.3 - 0.5) * 1.8 + 32; //conversion to the actual temperature in farenheit allows for reusability of function
- temp2 = (temp2 * 10 * 3.3 - 0.5) * 1.8 + 32;
+ temp1 = (temp1 * 10 * 3.3 - 50) * 1.8 + 32; //conversion to the actual temperature in farenheit allows for reusability of function
+ temp2 = (temp2 * 10 * 3.3 - 50) * 1.8 + 32;
}
void updateTempDifference(){ //this is the function called by main to update the previous and current temperature readings
