From 770e8ca9ca20a032777a75c40cb2e23bf8115b77 Mon Sep 17 00:00:00 2001 From: lahouass Date: Thu, 16 Jan 2020 11:04:23 +0100 Subject: [PATCH] envoi de données de arduino vers Raspi sur port serie --- arduinoToRpi.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+), 0 deletions(-) create mode 100644 arduinoToRpi.c diff --git a/arduinoToRpi.c b/arduinoToRpi.c new file mode 100644 index 0000000..225fc87 --- /dev/null +++ b/arduinoToRpi.c @@ -0,0 +1,56 @@ +#include // for the input/output register +#include +#include +#include +#include +#include +#include + +#define PRESCALER 1024 +#define TIME_SLOT 20 +#define NB_TICK 113 +#define BAUDRATE 103 + +void send_serial(unsigned char c) +{ + loop_until_bit_is_set(UCSR0A, UDRE0); + UDR0 = c; +} + +void send_msg(void){ + char msg[] = "Bonjour\r\n"; + while(1){ //nécessaire pour eviter d'executer la tache une seule fois + int i=0; + for(i=0; i