- Argos: Szeretem az ecetfát
- sziku69: Fűzzük össze a szavakat :)
- gban: Ingyen kellene, de tegnapra
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- Gurulunk, WAZE?!
- bambano: Bambanő háza tája
- Luck Dragon: Asszociációs játék. :)
- zebra_hun: Hűthető e kulturáltan a Raptor Lake léghűtővel a kánikulában?
- Elektromos rásegítésű kerékpárok
- GoodSpeed: Ugrás 32 GB RAM-ról 64 GB RAM-ra: Corsair Vengeance CMK64GX5M2B6000Z30
-
LOGOUT
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
tothferenc
aktív tag
sziasztok. Egy kis programozói segítségre lenne szükségem. Egy Ds18b20 szenzorral, egy arduino nanoval és egy oled kijelzővel reszeltem egy egyszerű hőmérőt. Viszont nem jövök rá, mi kell a sketch-be, hogy csak 1 tizedesjegyig írja a hőfokot.
eléggé az elején vagyok az arduinoba.
bedobom ide a kódot:
//Libraries available at: https://github.com/adafruit/Adafruit_SSD1306
// https://github.com/adafruit/Adafruit-GFX-Library
//https://github.com/milesburton/Arduino-Temperature-Control-Library
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <OneWire.h>
#include <DallasTemperature.h>
const int SensorDataPin = 2;
OneWire oneWire(SensorDataPin);
DallasTemperature sensors(&oneWire);
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire, -1);
void setup() {
Serial.begin(115200);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
display.clearDisplay();
display.setTextColor(WHITE);
}
void loop() {
dispTemp();
display.clearDisplay();
}
void dispTemp(void) { // function to read and display temperature
sensors.requestTemperatures(); // Send the command to DS18B20 to get temperatures
float temperatureDegC = sensors.getTempCByIndex(0);
displaytemp(temperatureDegC,'C'); // call to function void displaytemp(float temp, char C_F) giving temperature in Deg C and character C
}
void displaytemp(float temp, char C_F) // function to display temp, takes temperature and character C or F from calling function void dispTemp(void)
{
display.drawRect(1, 1, display.width()-1, display.height()-1, WHITE); // draws the outer rectangular boundary on the screen
//display.print("Temperature: "); display.print(temperature_Celsius); display.println(" *C");
display.setTextSize(1,2);
display.setCursor(32,6);
display.print("Homerseklet");
display.setTextColor(WHITE); // i have white OLED display, you can use other colors in case you have multicolored display
display.setTextSize(1); // i have used large font to display temperature, it can be varied as per your taste
display.setCursor(106,30);
display.print("o"); // this prints the "o" symbol to show Degree
display.setTextSize(2);
display.setCursor(112,37);
display.print(C_F); // this takes character from function call either C or F for centigrade of farenheit
if(temp >=100 || temp < 0){ //i have reduced font size if temp goes in 3 digits or is -ve, keeps text in center of display , it can be varied as per your taste
display.setTextSize(3);
display.setCursor(25,30);
}
else if(temp < 10 && temp >= 0){ //some adjustments to keep text in center of display , it can be varied as per your taste
display.setTextSize(3);
display.setCursor(25,30);
}
else
{
display.setTextSize(3); //i have used large font to display temperature, it can be varied as per your taste
display.setCursor(10,30);
}
display.print(temp); // finally prints the temperature on your OLED display
display.display();
}
Új hozzászólás Aktív témák
Hirdetés
- Konteó topic
- Microsoft Excel topic
- Egyre csak fejlődik az AI, emberek tízezreit rúgja majd ki a BT
- Argos: Szeretem az ecetfát
- A fociról könnyedén, egy baráti társaságban
- Eredeti játékok OFF topik
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- sziku69: Fűzzük össze a szavakat :)
- Synology NAS
- PlayStation 4
- További aktív témák...
- Corsair CX750M 750W Moduláris Tápegység
- DJI Mini 3 Fly More Combo drón telefonos távirányítóval
- Core i7 9700 processzor - 6 hó garival
- Dell 24" 1920x1080 full HD - webkamerás konferencia monitor hangszóróval! - gyári garancia 2028ig
- Dell Latitude 5590, 15,6" FULL HD IPS, I5-8350U CPU, 16GB DDR4, 256GB NVMe SSD, WIN 11 ÚJ AKKU
- Bomba ár! Lenovo ThinkPad T490s - i5-8GEN I 16GB I 512SSD I 14" FHD I Cam I W11 I Gari!
- Bomba ár! Dell Latitude E5570 - i5-6300U I 8GB I 256GB SSD I 15,6" FHD I HDMI I CAM I W10 I Gari!
- ÁRGARANCIA!Épített KomPhone i5 12400F 16/32/64GB RAM RTX 4060 Ti 8GB GAMER PC termékbeszámítással
- 2db Dell PowerEdge R740 2U Rack Szerver és 3db Netapp FAS2040 NAS
- LG 27GP95RP - 27" Nano IPS - UHD 4K - 160Hz 1ms - NVIDIA G-Sync - FreeSync Premium PRO - HDR 600
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged