• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
problem z atmega na płytce stykowej + ds18b20 +lcd
#3
(10-11-2017, 13:15)PlusMinus napisał(a): Witam!
Bez kodu to zawsze ciężko pomóc, ale mam pytanie: Jakiego używasz napięcia odniesienia dla ADC?
Pytam bo atmega32u4 ma 5V i 2.56V, atmega 328 posiada jeszcze dodatkowo 1.1V i może gdzieś tu leży problem, ale jak mówię wklej kod to popatrzymy.

Poniżej kod. Program po zmianie na płytkę arduino leonardo działa. Używam zestawu minicore dla atmegi 8 / 328 i mightycore dla Atmego 16/32


Kod:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>



#define ONE_WIRE_BUS 7
LiquidCrystal lcd(A3,A2,0,1,2,3);
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);


// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

/*
* The setup function. We only start the sensors here
*/
void setup(void)
{
 // start serial port
 
 lcd.begin(16, 2);
 // Start up the library
 sensors.begin();
}

/*
* Main function, get and show the temperature
*/
void loop(void)
{
 sensors.requestTemperatures();
 // call sensors.requestTemperatures() to issue a global temperature
 // request to all devices on the bus
 lcd.clear();
 lcd.print("temp ");
 // Send the command to get temperatures
 lcd.print(sensors.getTempCByIndex(0));  
}
 
Odpowiedź
  


Wiadomości w tym wątku
RE: problem z atmega na płytce stykowej + ds18b20 +lcd - przez mkj - 10-11-2017, 13:24

Skocz do:


Przeglądający: 1 gości