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 refid-mpu6050
Revision 4:1de605217c11, committed 2020-10-30
- Comitter:
- michaelrodriguezg
- Date:
- Fri Oct 30 22:00:05 2020 +0000
- Parent:
- 3:30e31f03d156
- Commit message:
- hola_3;
Changed in this revision
| MPU6050.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPU6050.lib Fri Oct 30 22:00:05 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Digiti-II/code/refid-mpu6050/#53afc190e56f
--- a/main.cpp Sun May 08 13:27:52 2016 +0000
+++ b/main.cpp Fri Oct 30 22:00:05 2020 +0000
@@ -1,75 +1,52 @@
-//Test of cheap 13.56 Mhz RFID-RC522 module from eBay
-//This code is based on Martin Olejar's MFRC522 library. Minimal changes
-//Adapted for Nucleo STM32 F401RE. Should work on other Nucleos too
-
-//Connect as follows:
-//RFID pins -> Nucleo header CN5 (Arduino-compatible header)
-//----------------------------------------
-//RFID IRQ=pin5 -> Not used. Leave open
-//RFID MISO=pin4 -> Nucleo SPI_MISO=PA_6=D12
-//RFID MOSI=pin3 -> Nucleo SPI_MOSI=PA_7=D11
-//RFID SCK=pin2 -> Nucleo SPI_SCK =PA_5=D13
-//RFID SDA=pin1 -> Nucleo SPI_CS =PB_6=D10
-//RFID RST=pin7 -> Nucleo =PA_9=D8
-//3.3V and Gnd to the respective pins
-
#include "mbed.h"
+#include "MPU6050.h"
#include "MFRC522.h"
-
-// Nucleo Pin for MFRC522 reset (pick another D pin if you need D8)
-#define MF_RESET p15
-#define SPI_MOSI p5
-#define SPI_MISO p6
-#define SPI_SCK p7
-#define SPI_CS p8
-
-DigitalOut LedGreen(LED1);
-
-//Serial connection to PC for output
-Serial pc(USBTX, USBRX);
-
-MFRC522 RfChip (SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, MF_RESET);
-
-int main(void) {
- pc.printf("starting...\r\n");
-
- // Init. RC522 Chip
- RfChip.PCD_Init();
-
- pc.printf("init passed\r\n");
-
-
- while (true) {
- LedGreen = 1;
-
- // Look for new cards
- if ( ! RfChip.PICC_IsNewCardPresent())
- {
- wait_ms(500);
- continue;
+#define MF_RESET PB_1
+#define SPI_MOSI PA_7
+#define SPI_MISO PA_6
+#define SPI_SCK PA_5
+#define SPI_CS PA_4
+
+DigitalOut myled(PC_13);
+Serial pc(PA_2, PA_3);// TX / RX
+MPU6050 ark(PB_7,PB_6);
+MFRC522 RfChip (SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, MF_RESET);
+
+int main(){
+ pc.printf("INICIANDO PROGRAMA\r\n");
+ pc.printf("MPU6050 \n");
+ RfChip.PCD_Init();
+ while(true) {
+
+ myled = 1;
+ //reading Temprature
+ float temp = ark.getTemp();
+ pc.printf("temprature = %0.2f ^C\r\n",temp);
+ //reading Grometer readings
+ float gyro[3];
+ ark.getGyro(gyro);
+ pc.printf("Gyro0=%f,\tGyro1=%f,\tGyro2=%f\r\n",gyro[0],gyro[1],gyro[2]);
+ wait_ms(1000);
+ if ( ! RfChip.PICC_IsNewCardPresent()){
+ wait_ms(500);
+ continue;
+// Select one of the cards
+ if (!RfChip.PICC_ReadCardSerial()){
+ wait_ms(500);
+ pc.printf("card read\r\n");
+ continue;
+ }
+ myled = 0;
+ // Print Card UID
+ pc.printf("Card UID: ");
+ for (uint8_t i = 0; i < RfChip.uid.size; i++){
+ pc.printf(" %X02", RfChip.uid.uidByte[i]);
+ }
+ pc.printf("\n\r");
+ // Print Card type
+ uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak);
+ pc.printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType));
+ wait_ms(1000);
}
-
- // Select one of the cards
- if (!RfChip.PICC_ReadCardSerial())
- {
- wait_ms(500);
- pc.printf("card read\r\n");
- continue;
- }
-
- LedGreen = 0;
-
- // Print Card UID
- pc.printf("Card UID: ");
- for (uint8_t i = 0; i < RfChip.uid.size; i++)
- {
- pc.printf(" %X02", RfChip.uid.uidByte[i]);
- }
- pc.printf("\n\r");
-
- // Print Card type
- uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak);
- pc.printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType));
- wait_ms(1000);
- }
+ }
}
\ No newline at end of file