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:aa27a09e44d2, committed 2017-08-19
- Comitter:
- LCRodriguez
- Date:
- Sat Aug 19 21:49:33 2017 +0000
- Commit message:
- VoltiLeds
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/BCDSEG.h Sat Aug 19 21:49:33 2017 +0000
@@ -0,0 +1,16 @@
+#ifndef BCDSEG_h
+#define BSDSEG_h
+#include "mbed.h"
+
+class And
+{
+ public:
+ int entrada(PinName a,PinName b,PinName c,PinName d);
+ void ve(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g,PinName h,PinName i,PinName j,PinName k,PinName l);
+ void bcd(float number);
+ private:
+ PinName a_;PinName b_;PinName c_;PinName d_;PinName e_;PinName f_;PinName g_;PinName h_;PinName i_;PinName j_;PinName k_;PinName l_;
+ int dipS;
+};
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/BDCSEG.cpp Sat Aug 19 21:49:33 2017 +0000
@@ -0,0 +1,90 @@
+#include "BCDSEG.h"
+
+int led[12]={0x001,0x003,0x007,0x00f,0x01f,0x03f,0x07f,0x0ff,0x1ff,0x3ff,0x7ff,0xfff};
+void And::ve(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g,PinName h,PinName i,PinName j,PinName k,PinName l)
+{
+
+ a_= a;
+ b_= b;
+ c_= c;
+ d_= d;
+ e_= e;
+ f_= f;
+ g_= g;
+ h_= h;
+ i_= i;
+ j_= j;
+ k_= k;
+ l_= l;
+}
+void And::bcd(float number)
+
+{
+ if (number <= 0.275)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[0];
+ }
+ if (number>0.275&&number<=0.275*2)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[1];
+ }
+ if (number>0.275*2&&number<=0.275*3)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[2];
+ }
+ if (number>0.275*3&&number<=0.275*4)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[3];
+ }
+ if (number>0.275*4&&number<=0.275*5)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[4];
+ }
+ if (number>0.275*5&&number<=0.275*6)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[5];
+ }
+ if (number>0.275*6&&number<=0.275*7)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[6];
+ }
+ if (number>0.275*7&&number<=0.275*8)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[7];
+ }
+ if (number>0.275*8&&number<=0.275*9)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[8];
+ }
+ if (number>0.275*9&&number<=0.275*10)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[9];
+ }
+ if (number>0.275*10&&number<=0.275*11)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[10];
+ }
+ if (number>0.275*11&&number<=0.275*12)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[11];
+ }
+ if (number>0.275*12)
+ {
+ BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ Leds=led[12];
+ }
+
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Aug 19 21:49:33 2017 +0000
@@ -0,0 +1,21 @@
+#include "BCDSEG.h"
+
+BusOut Leds(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+Serial pc(USBTX,USBRX);
+int volta;
+AnalogIn Pote(A0);
+int main()
+{
+ And Encen;
+ Encen.ve(D13,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12);
+ while(1)
+ {
+
+ float volta=Pote.read_u16()*0.000050354;
+ pc.printf("Hola mundo :%0.2f\r",volta);
+ Encen.bcd(volta);
+ wait(0.06);
+
+ }
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 19 21:49:33 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d \ No newline at end of file