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.
Dependencies: mbed mbed-rtos tsi_sensor SLCD
Revision 4:63adf2970ba5, committed 2020-03-10
- Comitter:
- evarmeriv
- Date:
- Tue Mar 10 21:29:54 2020 +0000
- Parent:
- 3:a5d13ab0abf2
- Commit message:
- Lab5
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Mar 03 22:28:41 2020 +0000
+++ b/main.cpp Tue Mar 10 21:29:54 2020 +0000
@@ -225,7 +225,7 @@
//I2C i2c1(D14, D15); //external I2C bus (commonly real-time clock);
//alternative serial port
-Serial uart1(PTE0,PTE1);
+//Serial uart1(PTE0,PTE1);
//IMPORTANT NOTE: i2c1 and uart1 both use PTE0/PTE1 so cannot be used simultaneously.
@@ -240,15 +240,43 @@
//BusIn switches(PTE16, PTE17, PTE18, PTE19, PTA17, PTA16, PTA15, PTA14);
Serial pc(USBTX, USBRX); // MBED standard pin names
+SPI spi(PTD6, PTD7, PTD5);
+DigitalOut ce(PTD2);
+DigitalOut pl(PTD4);
+DigitalOut rclk(PTA13);
+
#include "seven_segment.h"
#include "keypad4x4.h"
-char n;
+char switches, n;
int main()
{
+
+ pc.baud(115200);
+
+ //char c;
+ //printf("Enter a character: ");
+ //scanf("%c", &c);
+
+ // %d displays the integer value of a character
+ // %c displays the actual character
+ //printf("\nASCII value of %c = %d\n", c, c);
+
+
+
+
while(true)
- {
+ {
n=keypad4x4_getc();
- seven_segment_output(n);
+
+ pl=0;
+ wait(10E-6);
+ pl=1;
+ ce=0;
+ switches = spi.write(seven_segment_find_pattern(n));
+ ce =1;
+ rclk = 1;
+ wait(10E-6);
+ rclk = 0;
}
}