2018-04-30 22:40:20 +02:00
|
|
|
/* Teste si une broche est connecté à une autre */
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
2018-05-01 08:45:02 +02:00
|
|
|
#include <wiringPi.h>
|
2018-04-30 22:40:20 +02:00
|
|
|
#include <wiringPiI2C.h>
|
|
|
|
|
|
|
|
#include "lcd.h"
|
2018-05-01 08:45:02 +02:00
|
|
|
#include "CF.h"
|
2018-05-06 08:14:51 +02:00
|
|
|
#include "motor.h"
|
2018-05-01 08:45:02 +02:00
|
|
|
#include "buttons.h"
|
2018-04-30 22:40:20 +02:00
|
|
|
|
2018-05-06 12:50:03 +02:00
|
|
|
#define PATATE 2
|
2018-05-02 05:51:14 +02:00
|
|
|
|
2018-04-30 22:40:20 +02:00
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
|
|
|
|
(void)argc;
|
|
|
|
(void)argv;
|
|
|
|
|
2018-05-01 08:45:02 +02:00
|
|
|
wiringPiSetup();
|
2018-04-30 22:40:20 +02:00
|
|
|
|
2018-05-01 08:45:02 +02:00
|
|
|
initI2C();
|
2018-04-30 22:40:20 +02:00
|
|
|
initLCD();
|
2018-05-01 08:45:02 +02:00
|
|
|
configureCF();
|
|
|
|
configureButtons();
|
2018-04-30 22:40:20 +02:00
|
|
|
|
|
|
|
for (;;) {
|
2018-05-01 08:45:02 +02:00
|
|
|
clearLCD();
|
|
|
|
printToLCD(LCD_LINE_1, "Forward");
|
2018-05-06 12:50:03 +02:00
|
|
|
setMoteurTension(PATATE, PATATE);
|
2018-05-01 08:45:02 +02:00
|
|
|
pressedButton(BUT_BLOCK);
|
|
|
|
|
|
|
|
clearLCD();
|
|
|
|
printToLCD(LCD_LINE_1, "Right");
|
2018-05-06 12:50:03 +02:00
|
|
|
setMoteurTension(-PATATE, PATATE);
|
2018-05-01 08:45:02 +02:00
|
|
|
pressedButton(BUT_BLOCK);
|
|
|
|
|
|
|
|
clearLCD();
|
|
|
|
printToLCD(LCD_LINE_1, "Left");
|
2018-05-06 12:50:03 +02:00
|
|
|
setMoteurTension(PATATE, -PATATE);
|
2018-05-01 08:45:02 +02:00
|
|
|
pressedButton(BUT_BLOCK);
|
|
|
|
|
|
|
|
clearLCD();
|
|
|
|
printToLCD(LCD_LINE_1, "Backward");
|
2018-05-06 12:50:03 +02:00
|
|
|
setMoteurTension(-PATATE, -PATATE);
|
2018-05-01 08:45:02 +02:00
|
|
|
pressedButton(BUT_BLOCK);
|
|
|
|
|
|
|
|
clearLCD();
|
|
|
|
printToLCD(LCD_LINE_1, "Brake");
|
|
|
|
brake();
|
|
|
|
pressedButton(BUT_BLOCK);
|
|
|
|
|
|
|
|
clearLCD();
|
|
|
|
printToLCD(LCD_LINE_1, "Free");
|
|
|
|
freewheel();
|
|
|
|
pressedButton(BUT_BLOCK);
|
2018-04-30 22:40:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|