Time is good

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

main.cpp

Committer:
sype
Date:
2016-04-28
Revision:
48:03da1aead032
Parent:
46:5658af4e5149
Child:
49:5e2f7323f280

File content as of revision 48:03da1aead032:

#include "func.h"

/* Déclaration des différents éléments de l'IHM */

InterruptIn CAMP(PA_15);
InterruptIn START(PB_7);
DigitalOut LEDR(PC_2);
DigitalOut LEDV(PC_3);

InterruptIn mybutton(USER_BUTTON);
DigitalIn button(USER_BUTTON);

DigitalIn ChannelA1(PA_1);
DigitalIn ChannelB1(PA_0);
DigitalIn ChannelA2(PA_5);
DigitalIn ChannelB2(PA_6);

DigitalOut bleu(PC_5);
DigitalOut blanc(PC_6);
DigitalOut rouge(PC_8);

/* AX12 - non fonctionnels, je pense que le souci vient de la bibliothèque car la trame n'est pas correcte (analyseur logique) */
//AX12 left_hand(PA_9, PA_10, 4, 250000);
//AX12 right_hand(PA_9, PA_10, 1, 250000);

/* Sharp */
AnalogIn capt1(PA_4);
AnalogIn capt2(PB_0);
AnalogIn capt3(PC_1);
AnalogIn capt4(PC_0);

/* Moteurs pas à pas */
Stepper RMot(NC, PA_8, PC_7);
Stepper ZMot(NC, PB_4, PB_10);
Stepper LMot(NC, PB_5, PB_3);
/* Fins de course */
InterruptIn EndR(PB_15);
InterruptIn EndZ(PB_14);
InterruptIn EndL(PB_13);

Ticker ticker;

Serial logger(USBTX, USBRX);
//Serial logger(PA_9, PA_10);
RoboClaw roboclaw(ADR, 460800, PA_11, PA_12);
Odometry odo(61.7, 61.8, ENTRAXE, 4096, roboclaw);

int SIMON_i = 0, SIMON_state = 0, SCouleur = 1, SStart = 0;
bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false;

void init(void);
void update_main(void);

/* Debut du programme */
int main(void)
{
    init();
    while(1);
}

void init(void)
{
    logger.baud(9600);
    logger.printf("Coucou!\n\r");
    roboclaw.ForwardM1(0);
    roboclaw.ForwardM2(0);
    while(SStart==0);
    wait(1);
    odo.setPos(110, 1000, 0);
    roboclaw.ResetEnc();
    init_interrupt();
    wait_ms(100);
    logger.printf("End init\n\r");
}

void update_main(void)
{
    //odo.update_odo();
    //checkAround();
}