Skip to content
Extraits de code Groupes Projets
Valider 38719b9c rédigé par Diego de Bernard de Fauconval's avatar Diego de Bernard de Fauconval
Parcourir les fichiers

plein de trucs

parent 8cb00734
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -103,9 +103,7 @@ int main(int argc, char const *argv[]) {
cin >> answer ;
if (answer == "led") useTheLED();
else if (answer == "adc") {
useADC();
}
else if (answer == "adc") useADC();
return 0;
......
......@@ -9,6 +9,8 @@ motor : compile_motor
i2c : compile_LED
sudo ./i2c
uart : compile_UART
sudo ./uart
# compilations
compile_switch :
......@@ -20,6 +22,9 @@ compile_motor :
compile_LED :
g++ -o i2c I2C.cpp -lwiringPi
compile_UART :
g++ -o uart uart.cpp -lwiringPi
.PHONY : clean
clean :
rm -rf switch motor led i2c
rm -rf switch motor led i2c uart
......@@ -14,16 +14,16 @@ const int ENC_PIN_2A = 35; //from FPGA to ENCODER -> ouput data from encod
const int ENC_PIN_2B = 34; //from FPGA to ENCODER -> ouput data from encoder
const int SCK_PIN = 14; //from RASPI to FPGA -> clock signal
const int SCK_PIN_FPGA = 13; //from FPGA to ENCODER -> clock signal
const int SS_PIN_1 = 10; //CE0 from RASPI to FPGA -> enable encoder
const int SS_PIN_2 = 11; //CE1 from RASPI to FPGA -> enable encoder
const int CE0_PIN_FPGA = 11;
const int CE1_PIN_FPGA = 11;
const int CE1_PIN_FPGA = 15;
int main(int argc, char const *argv[])
{
if (wiringPiSetup() == -1) {
printf("WiringPiSetup failed\n");
exit(EXIT_FAILURE);
}
pinMode(ENC_PIN_1A, INPUT);
pinMode(ENC_PIN_1B, INPUT);
......
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <wiringSerial.h>
#include <wiringPi.h>
#include <iostream>
using namespace std;
const char TURN_ON[] = "Turn Led On";
const char TURN_OFF[] = "Turn Led Off";
int main(int argc, char const *argv[])
{
int fd = serialOpen("/dev/ttyS0", 9600);
if (fd == -1 || wiringPiSetup() == -1) {
printf("UART PAS OK\n");
exit(EXIT_FAILURE);
}
serialPrintf(fd, TURN_ON);
delay(1000);
int response;
while (true) {
if (serialDataAvail(fd)) {
response = serialGetchar(fd);
break;
}
}
cout << response << endl;
printf("%c\n", response);
serialPrintf(fd, TURN_OFF);
delay(200);
while (true) {
if (serialDataAvail(fd) > 0) {
cout << serialDataAvail(fd) << endl;
for (int i = 0; i < serialDataAvail(fd); i++)
{
response = serialGetchar(fd);
}
break;
}
}
cout << response << endl;
serialClose(fd);
return 0;
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter