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.
Diff: main.cpp
- Revision:
- 13:af3d7d8d77fc
- Parent:
- 12:d8370e1350db
- Child:
- 14:0480ed7efd7f
--- a/main.cpp Fri May 03 15:34:30 2019 +0000 +++ b/main.cpp Fri May 03 15:56:34 2019 +0000 @@ -63,6 +63,7 @@ #include "mbed.h" #include "MFRC522.h" +#include "room.hpp" #define COMPILING_FOR_KL25Z 0 //Set this to 1 to compile with KL25Z pins @@ -131,6 +132,9 @@ bool r0_state; bool r1_state; +Room r0; +Room r1; + //Serial connection to terminal for output Serial pc(SERIAL_TX, SERIAL_RX); @@ -139,13 +143,20 @@ MFRC522 rfid2(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS2, MF_RESET2); int main(void) { - printf("Starting the Team 2 Pro 2 House...\n\r"); + printf("Starting the Team 2 Pro 2 House...\r\n"); + + //Test Daniel's Room class + r0.RoomCall(12345); + r0.RoomCall(54321); + r0.RoomCall(12345); + + wait_ms(1000); // Init. RC522 chips rfid1.PCD_Init(); rfid2.PCD_Init(); - printf("Resetting latches...\n\r"); + printf("Resetting latches...\r\n"); r0_set = 0; r0_rst = 1; r0_state = false; @@ -155,9 +166,9 @@ wait_ms(500); r0_rst = 0; r1_rst = 0; - printf("Done.\n\r"); + printf("Done.\r\n"); - printf("Starting RFID monitoring...\n\r"); + printf("Starting RFID monitoring...\r\n"); while (true) { LedGreen = 1; @@ -171,7 +182,7 @@ for (uint8_t i = 0; i < rfid1.uid.size; i++) { printf(" %02X", rfid1.uid.uidByte[i]); } - printf("\n\r"); + printf("\r\n"); //pulse room 0 (front door) latch r0_state = !r0_state; @@ -195,7 +206,7 @@ for (uint8_t i = 0; i < rfid2.uid.size; i++) { printf(" %02X", rfid2.uid.uidByte[i]); } - printf("\n\r"); + printf("\r\n"); //pulse room 1 (front door) latch r1_state = !r1_state;