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.
Fork of 7SegmentDisplay by
Diff: main.cpp
- Revision:
- 3:c747b832518f
- Parent:
- 2:3cf4eba9de56
diff -r 3cf4eba9de56 -r c747b832518f main.cpp
--- a/main.cpp Sun Sep 04 11:54:00 2016 +0000
+++ b/main.cpp Tue Sep 06 06:27:58 2016 +0000
@@ -82,12 +82,14 @@
float f = 0.005;
//enter a float number here (with a decimal in it) starting point
volatile float temp = 31.45;
+int t = temp * 100;
int main(){
+while (1){
//finessing the digits out one at a time knowing 2nd digit has the decimal
-int tempasinteger = temp * 100; //removes decimal and typecasts float to integer
-int temp1a=tempasinteger/1000; //typecast float to integer for 1st digit (was)
-int temp2 = tempasinteger - temp1a*1000; //gets last 3 digits
+//int tempasinteger = temp * 100; //removes decimal and typecasts float to integer
+int temp1a = t/1000; //typecast float to integer for 1st digit (was)
+int temp2 = t - temp1a*1000; //gets last 3 digits
int temp2a = temp2/100; //typecast float to integer for 2nd digit
int temp3 = temp2 - temp2a*100; //get last 2 digits
@@ -100,7 +102,7 @@
Digit2 = 1; //turn off digit2
Digit3 = 1; //turn off digit3
Digit4 = 1; //turn off digit4
- while (1) {
+// while (1) {
//turns off last led's segments values
for(int i = 0; i<8;i++){
led[i] = 0;}
@@ -142,9 +144,17 @@
//belows holds row of matrix and assign column value from matrix
Digit4 = 0; //turns on digit4
for (int i=0; i<8; i++){
- led[i] = matrix[temp4a][i]; }
+ led[i] = matrix[temp4a][i];
+ }
wait(f);
Digit4=1;
- }
-}
\ No newline at end of file
+ //loop & increment
+ if (t <3600)
+ t=t+1;
+ else
+ t=3200;
+
+
+ } //close for while 1
+} //close for main
\ No newline at end of file
