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: MPU9250_SPI SDFileSystem XBeeLib
main.cpp
- Committer:
- gusteibolt
- Date:
- 2017-10-12
- Revision:
- 6:939df52d75c9
- Parent:
- 5:18e89e309715
- Child:
- 7:ebaaff27840b
File content as of revision 6:939df52d75c9:
/*
* Los Putacos
* Copyright (C) 2017, All rights reserved.
* ________________________________________
*
* Created by: Gustavo Campana, Michael Schmidt, Miguel Lopez
* Date: 11-Oct-2017
* Version: V0.1
*/
//-----------------------------------------------------------------
// Board: NUCLEO - F401RE
// Version: MR1136 rev C
//-----------------------------------------------------------------
//-----------------------------------------------------------------
// Includes
#include "mbed.h"
#include "rtos.h"
#include "mbed_events.h"
#include "configuration.h"
#include "MPU9250.h"
//-----------------------------------------------------------------
//-----------------------------------------------------------------
// Declarations
//Analog Input
AnalogIn micro(A0);
//Digital Input
DigitalOut led1(LED1);
Timer t; //Timer µS time-stamp
EventQueue queue(32 * EVENTS_EVENT_SIZE); //Event
Serial pc(USBTX, USBRX); // PC Serial (Debug)
MPU9250 mpu9250; // IMU MPU-9255 by Kris Winer
//-----------------------------------------------------------------
//-----------------------------------------------------------------
// Global Variables
// Your code here!
//-----------------------------------------------------------------
//-----------------------------------------------------------------
void Setup(){
// PC Serial (Debug) baudrate
pc.baud(9600);
pc.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock);
// Task queue
int task1_id = queue.call_every(1000, printf, "called every 1 seconds\n");
int task2_id = queue.call_every(2500, printf, "called every 2.5 seconds\n");
int task3_id = queue.call_every(3000, print_thread, (void *)"called every 3 seconds\n");
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
void initMPU9250()
{
// Initialize MPU9250 device
// wake up device
//writeByte(MPU9250_ADDRESS, PWR_MGMT_1, 0x00); // Clear sleep mode bit (6), enable all sensors
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
int main()
{
Setup(); // Initial setups
//Reading the analog input (Microphone) array = micro.read_u16();
while (true) {
queue.dispatch();
}
}
//-----------------------------------------------------------------

