1
0
Fork 0
mirror of https://github.com/RobotechLille/cdf2018-principal synced 2024-05-17 04:26:00 +02:00
cdf2018-principal/chef/src/testForward.c
2018-05-11 05:34:06 +02:00

65 lines
1.3 KiB
C

/* Teste si une broche est connecté à une autre */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <wiringPi.h>
#include <wiringPiI2C.h>
#include "lcd.h"
#include "motor.h"
#include "buttons.h"
int main(int argc, char* argv[])
{
(void)argc;
(void)argv;
float patate = 2;
if (argc == 2) {
sscanf(argv[1], "%f", &patate);
}
wiringPiSetup();
initI2C();
initLCD();
configureButtons();
configureMotor();
for (;;) {
clearLCD();
printToLCD(LCD_LINE_1, "Forward");
setMoteurTension(patate, patate);
pressedButton(BUT_BLOCK);
clearLCD();
printToLCD(LCD_LINE_1, "Right");
setMoteurTension(-patate, patate);
pressedButton(BUT_BLOCK);
clearLCD();
printToLCD(LCD_LINE_1, "Left");
setMoteurTension(patate, -patate);
pressedButton(BUT_BLOCK);
clearLCD();
printToLCD(LCD_LINE_1, "Backward");
setMoteurTension(-patate, -patate);
pressedButton(BUT_BLOCK);
clearLCD();
printToLCD(LCD_LINE_1, "Brake");
brake();
pressedButton(BUT_BLOCK);
clearLCD();
printToLCD(LCD_LINE_1, "Free");
freewheel();
pressedButton(BUT_BLOCK);
}
}