Open Edumarek123 opened 1 year ago
if you want to "integrate" and compile in arduino IDE, best choice imho is to port inside the sketch the onewire.c and ds18b20.c code.. btw do NOT mix the plain C code (while forever) with arduino scheme of function based on a setup() and loop().
ERROR: undefined reference to `DS18B20_read(unsigned char)'
my code:
include
include <avr/io.h>
include <util/delay.h>
include "ds18b20.h"
//Pinos
define PIN_SENSOR_TEMPERATURA PB2
define PIN_COMPRESSOR (0x08)
//Parametros const int8_t TEMPERATURA_MINIMA=17; const int8_t TEMPERATURA_MAXIMA=20;
//Funcoes void liga_compressor(); void desliga_compressor();
int main(){ //PORTAS DDRB|=(PIN_COMPRESSOR); //PB3 como saida - compressor
//VARIAVEIS int16_t ultima_temperatura;
while (true) { ultima_temperatura=DS18B20_read(PIN_SENSOR_TEMPERATURA);
}
return 0; }
void liga_compressor(){ PORTB|=(PIN_COMPRESSOR); }
void desliga_compressor(){ PORTB&=~(PIN_COMPRESSOR); }