L'équipe robotique FIP a pour but de participer à la Coupe de France de Robotique (http://www.planete-sciences.org/robot/?section=pages&pageid=79). L'équipe est composée d'étudiants de l'école d'ingénieur Télécom Bretagne en filière par partenariat. Nous utilisons comme plateforme les microcontrôleurs STM32 associés aux cartes NUCLEO.

Dependencies:   mbed HC_SR04_Ultrasonic_Library Nucleo_Sensor_Shield VL6180x_lib

Fork of Coupe Robotique FIP by Julien Tiron

We are a team of students building an autonomous robot which will compete in the French Robotic Cup.

main.cpp

Committer:
quentin9696
Date:
2015-05-21
Revision:
11:fce59d46840f
Parent:
4:149c4509b35d

File content as of revision 11:fce59d46840f:

#include "mbed.h"
#include "ultrasonic.h"
#include "Imu.h"

/*
 void dist(int distance)
{
    //put code here to happen when the distance is changed
    printf("Distance changed to %dmm\r\n", distance);
}

ultrasonic mu(D8, D9, .1, 1, &dist);    //Set the trigger pin to D8 and the echo pin to D9
                                        //have updates every .1 seconds and a timeout after 1
                                        //second, and call dist when the distance changes

int main()
{
    mu.startUpdates();//start mesuring the distance
    while(1)
    {
        //Do something else here
        mu.checkDistance();     //call checkDistance() as much as possible, as this is where
                                //the class checks if dist needs to be called.
    }
}*/

Imu i;
Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut myled(LED1);
Data_IMU * foo;
Data_IMU * bar;

int main()
{  
    
    i.setOffset();
    foo = i.getOffset();
    bar = i.getData();
    
    while(1) {
        
        myled = 1; // LED is ON
        wait(0.2); // 200 ms
        myled = 0; // LED is OFF
        wait(10);
        
        i.refresh(1);
        
        
        /*pc.printf("OFFSET : \r\n");
        pc.printf("Temperature:\t\t %f C\r\n", foo->TEMPERATURE_Value_C);
        pc.printf("Humidity:\t\t %f%%\r\n", foo->HUMIDITY_Value);
        pc.printf("Pressure:\t\t %f hPa\r\n", foo->PRESSURE_Value);
        pc.printf("Magnetometer (mGauss):\t X: %d, Y: %d, Z: %d\r\n", foo->MAG_Value->AXIS_X, foo->MAG_Value->AXIS_Y, foo->MAG_Value->AXIS_Z);
        pc.printf("Accelerometer (mg):\t X: %d, Y: %d, Z: %d\r\n", foo->ACC_Value->AXIS_X, foo->ACC_Value->AXIS_Y, foo->ACC_Value->AXIS_Z);
        pc.printf("Gyroscope (mdps):\t X: %d, Y: %d, Z: %d\r\n", foo->GYR_Value->AXIS_X, foo->GYR_Value->AXIS_Y, foo->GYR_Value->AXIS_Z);
        pc.printf("\r\n");*/
        
        pc.printf("RAW DATA : \r\n");
        pc.printf("Temperature:\t\t %f C\r\n", bar->TEMPERATURE_Value_C);
        pc.printf("Humidity:\t\t %f%%\r\n", bar->HUMIDITY_Value);
        pc.printf("Pressure:\t\t %f hPa\r\n", bar->PRESSURE_Value);
        pc.printf("Magnetometer (mGauss):\t X: %d, Y: %d, Z: %d\r\n", bar->MAG_Value->AXIS_X, bar->MAG_Value->AXIS_Y, bar->MAG_Value->AXIS_Z);
        pc.printf("Accelerometer (mg):\t X: %d, Y: %d, Z: %d\r\n", bar->ACC_Value->AXIS_X, bar->ACC_Value->AXIS_Y, bar->ACC_Value->AXIS_Z);
        pc.printf("Gyroscope (mdps):\t X: %d, Y: %d, Z: %d\r\n", bar->GYR_Value->AXIS_X, bar->GYR_Value->AXIS_Y, bar->GYR_Value->AXIS_Z);
        pc.printf("\r\n");
        
        
    }
}