From 6637616fbc5f6bf24d4b64dc7dc87410181bb78e Mon Sep 17 00:00:00 2001 From: lahouass Date: Sat, 21 Mar 2020 20:22:23 +0100 Subject: [PATCH] code de température effectif --- codes/temperature.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+), 0 deletions(-) create mode 100644 codes/temperature.c diff --git a/codes/temperature.c b/codes/temperature.c new file mode 100644 index 0000000..1698a96 --- /dev/null +++ b/codes/temperature.c @@ -0,0 +1,53 @@ +#include // for the input/output register +#include +#include +#include +#include +#include + +#include "libretour.h" + +#define PRESCALER 1024 +#define TIME_SLOT 20 +#define BAUDRATE 103 + +#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) +#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) + +char Donnee[24]; +float temp; + +// équivalent de analogueRead() +int analogReadNew(uint8_t pin) { + //Selection de la fréquence du prescaler + ADCSRA |= (1<