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 0:3ee5a8d856a5, committed 2014-03-13
- Comitter:
- chivaa_chino
- Date:
- Thu Mar 13 14:27:48 2014 +0000
- Commit message:
- Tarea de la clase de Informatica Industrial
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 3ee5a8d856a5 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Mar 13 14:27:48 2014 +0000
@@ -0,0 +1,97 @@
+#include "mbed.h"
+
+BusOut Seg2(PTC8, PTC9, PTA5, PTA4, PTA12, PTD4, PTA2, PTA1);
+BusOut Seg1(PTC11, PTC10, PTC6, PTC5, PTC4, PTC3, PTC0, PTC7);
+
+AnalogIn vin(PTB3);
+AnalogIn res(PTC2);
+
+DigitalOut dp1(PTC13);
+DigitalOut dp2(PTC12);
+
+DigitalIn boton(PTA13);
+char SegConvert(char SegValue);
+char i, x;
+int h, estado=0;
+float decena, unidad, vout, ohm;
+void volts(void);
+void resis(void);
+void push(void);
+
+int main(){
+ while(1){
+
+ if(boton==1){
+ estado=!estado;
+ }
+
+ if(estado==1){
+ volts();
+ }
+ else{
+ resis();
+ }
+
+
+
+
+ }
+ }
+char SegConvert(char SegValue) {
+ char SegByte=0x7F;
+ switch (SegValue){
+ case 0 : SegByte = 0xC0; break;
+ case 1 : SegByte = 0xF9; break;
+ case 2 : SegByte = 0x24; break;
+ case 3 : SegByte = 0x30; break;
+ case 4 : SegByte = 0x19; break;
+ case 5 : SegByte = 0x12; break;
+ case 6 : SegByte = 0x02; break;
+ case 7 : SegByte = 0x78; break;
+ case 8 : SegByte = 0x00; break;
+ case 9 : SegByte = 0x10; break;
+ }
+ return SegByte;
+ }
+
+
+ void resis(void){
+
+ ohm=((10000/res)-10000);
+ decena = (ohm/10000);
+ unidad = ohm-(decena*10000);
+
+ if(ohm>=1000){
+ Seg2 = SegConvert(decena);
+ Seg1 = SegConvert(unidad);
+ dp1=1;
+ dp2=0;
+ }
+
+ }
+
+
+
+ void volts(void){
+ dp1=1;
+ dp2=1;
+ decena=0;
+ unidad=0;
+ h=(vin*28);
+ if(h<10){
+ h=(vin*28*10);
+ decena = (h/10);
+ unidad = h-decena*10;
+ Seg2 = SegConvert(decena);
+ Seg1 = SegConvert(unidad);
+ dp1=0;
+ }
+
+ if(h>=10){
+ decena = (h/10);
+ unidad = h-decena*10;
+ Seg2 = SegConvert(decena);
+ Seg1 = SegConvert(unidad);
+ dp1=1;
+ }
+ }
\ No newline at end of file
diff -r 000000000000 -r 3ee5a8d856a5 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 13 14:27:48 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1 \ No newline at end of file