- Luck Dragon: Asszociációs játék. :)
- bitpork: Phautós tali a Balcsinál 2025 Augusztus 2 napján (szombat)
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- gban: Ingyen kellene, de tegnapra
- Elektromos rásegítésű kerékpárok
- sziku69: Szólánc.
- sziku69: Fűzzük össze a szavakat :)
- eBay-es kütyük kis pénzért
- f(x)=exp(x): A laposföld elmebaj: Vissza a jövőbe!
- Rap, Hip-hop 90'
Hirdetés
Talpon vagyunk, köszönjük a sok biztatást! Ha segíteni szeretnél, boldogan ajánljuk Előfizetéseinket!
-
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
-
lanszelot
addikt
válasz
lanszelot #20043 üzenetére
Ezzel a módszerrel sikerült.
Ma reggel neki ültem, mert tegnap már nagyonm fáradt voltam.
Minden gombnyomásra vált.
Mindenkinek köszönöm szépen a segítséget#include <MQ135.h> /*gaz erzekelo, de nem kell neki igazabol*/
#include <Adafruit_SSD1306.h> /*oled display*/
#include <splash.h> /*oled display -nek kell*/
#include <max6675.h> /*homero*/
int thermoDO = 10; /*valtozo a homero DO pin -nek*/
int thermoCS = 9; /*valtozo a homero CS pin -nek*/
int thermoCLK = 8; /*valtozo a homero CLK pin -nek*/
int gombNyomas = 1; /*valtozo a gomb nyomas szamlalasara*/
int gombPin = 4; /*valtozo a gomb pin -nek*/
int gombAllapot = 0; /*valtozo a gomb allapot olvasasahoz*/
byte a = 0; /*valtozo a gaz erzekelo negyzet villogashoz*/
int period = 1000; /*ennyi idot var a futtatashoz*/
unsigned long time_now = 0;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);
void mindenRajtaVan() {
int sensorValue = analogRead(A0); /*valtozo a gaz erzekelo alalog pin -nek*/
int isgas = digitalRead(2); /*valtozo a gaz erzekelo digitalis pin -nek, ez arra kell, ha gas van akkor jelet ad, nem kell kulon erteket adni*/
String gas; /*valtozo a gaz erzekelo gas vagy no gas kiirasahoz*/
display.clearDisplay(); /*this line to clear previous logo*/
display.setTextSize(1); /*text size 3*/
display.setCursor(3,0); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("Thermometer by Gabor");
display.setTextSize(2); /*text size 2*/
display.setCursor(10,20); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("C = ");
display.print(thermocouple.readCelsius());/*Celsius*/
display.setTextSize(1); /*text size 2*/
display.setCursor(10,40); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("F = ");
display.print(thermocouple.readFahrenheit());/*Fahrenheit*/
display.setTextSize(1); /*text size 2*/
display.setCursor(0,50); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("CO2 = ");
display.print(sensorValue);
display.print(" PPM ");
/*sensorValue < 90 ellenorzeshez, amugy igas valtozo kell ami a digitalis pin*/
if (sensorValue < 90) {gas = "No Gas";}
else {gas = " Gas";
if(a) {display.drawRoundRect(80, 47, 40, 15, 2, WHITE);} /*negyzet a gas felirat kore feher*/
else {display.drawRoundRect(80, 47, 40, 15, 2, BLACK);} /*negyzet a gas felirat kore fekete*/
a^=1;
}
display.print(gas);
display.display(); /*to shows or update your TEXT*/
}
void homeroVanRajta() {
display.clearDisplay(); /*this line to clear previous logo*/
display.setTextSize(1); /*text size 3*/
display.setCursor(3,0); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("Thermometer by Gabor");
display.setTextSize(2); /*text size 2*/
display.setCursor(10,20); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("C = ");
display.print(thermocouple.readCelsius());/*Celsius*/
display.setTextSize(2); /*text size 2*/
display.setCursor(10,40); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("F = ");
display.print(thermocouple.readFahrenheit());/*Fahrenheit*/
display.display(); /*to shows or update your TEXT*/
}
void gazVanRajta() {
int sensorValue = analogRead(A0); /*valtozo a gaz erzekelo alalog pin -nek*/
int isgas = digitalRead(2); /*valtozo a gaz erzekelo digitalis pin -nek, ez arra kell, ha gas van akkor jelet ad, nem kell kulon erteket adni*/
String gas; /*valtozo a gaz erzekelo gas vagy no gas kiirasahoz*/
display.clearDisplay(); /*this line to clear previous logo*/
display.setTextSize(1); /*text size 3*/
display.setCursor(3,0); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("Thermometer by Gabor");
display.setTextSize(2); /*text size 2*/
display.setCursor(0,20); /*ez tartja egy helyben a szöveget*/
display.setTextColor(WHITE); /*without this no display*/
display.print("CO2= ");
display.print(sensorValue);
display.setTextSize(1);
display.print(" PPM");
/*sensorValue < 90 ellenorzeshez, amugy igas valtozo kell ami a digitalis pin*/
if (sensorValue < 90) {gas = "No Gas";}
else {gas = " Gas";
if(a) {display.drawRoundRect(30, 39, 60, 22, 2, WHITE);} /*negyzet a gas felirat kore feher*/
else {display.drawRoundRect(30, 39, 60, 22, 2, BLACK);} /*negyzet a gas felirat kore fekete*/
a^=1;
}
display.setTextSize(2);
display.setCursor(20,42);
display.print(gas);
display.display(); /*to shows or update your TEXT*/
}
void megnyomva() {
if (gombNyomas == 1) {
gombNyomas++;
} else if (gombNyomas == 2) {
gombNyomas++;
} else if (gombNyomas == 3) {
gombNyomas = 1;
}
}
void setup() {
Serial.begin(9600); /*elindítja a sorosportot, 9600 baud beállítással. Ez azért jó, mert a Serial Monitoron a program futását tudod monitorozni*/
pinMode(gombPin, INPUT); /*inicializálja a gomb pin -jet inputnak*/
Serial.println("MAX6675 test");
/*wait for MAX chip to stabilize*/
delay(500);
/*SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally*/
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); /*Address 0x3C for 128x32*/
display.display();
delay(2000);
}
void loop() {
/*For the MAX6675 to update, you must delay AT LEAST 250ms between reads!*/
//delay(300);
/*read the state of the pushbutton value:*/
gombAllapot = digitalRead(gombPin);
/*check if the pushbutton is pressed. If it is, the buttonState is HIGH:*/
if (gombAllapot == HIGH) {
megnyomva();
}
//time_now = millis();
if(millis() >= time_now + period){
time_now += period;
if (gombNyomas == 1) {
mindenRajtaVan();
} else if (gombNyomas == 2) {
homeroVanRajta();
} else if (gombNyomas == 3) {
gazVanRajta();
}
}
Serial.println(gombNyomas);
}
Új hozzászólás Aktív témák
- Honda topik
- OLED TV topic
- Kerti grill és bográcsozó házilag (BBQ, tervek, ötletek, receptek)
- Formula-1
- Kerékpárosok, bringások ide!
- Luck Dragon: Asszociációs játék. :)
- Milyen légkondit a lakásba?
- Autós topik
- Samsung Galaxy Tab A 6 - fél kiló harminc, maradhat?
- Call of Duty: Black Ops 6
- További aktív témák...
- Corsair Vengeance LPX 2x8GB 3000MHz DDR4 kit
- Asus B85M-Plus + I3-4170 Processzor
- QNAP TS-932X - 10 gigabites NAS - 5x4TB HDD + 4x400G SSD
- SPIRIT OF GAMER Race Wheel PRO 2 kormány minden tartozékával mekgímélt állapotban eladó!
- Playstation 5 Drive Edition 825GB (CFI-1116A), 6 hónap garanciával, Bp-i üzletből eladó!
- Huawei Nova Y70 128GB, Kártyafüggetlen, 1 Év Garanciával
- Lenovo LEGION Pro 5 / Pro 7, Lenovo Yoga Pro gépek (RTX 4060 / 4070 / 4080 / 4090)
- LG 55C4 - 48" OLED evo - 4K 144Hz - 0.1ms - NVIDIA G-Sync - FreeSync - HDMI 2.1 - A9 Gen7 CPU
- Amazfit GTR Mini okosóra / Számla / Garancia /
- BESZÁMÍTÁS! Gigabyte B450M R5 5600 16GB DDR4 512GB SSD GTX 1080Ti 11GB ZALMAN I3 NEO Chieftec 650W
Állásajánlatok
Cég: FOTC
Város: Budapest