- Bambu Lab 3D nyomtatók
- Milyen cserélhető objektíves gépet?
- Autós kamerák
- Milyen házat vegyek?
- Bluetooth hangszórók
- Iszonyatos mennyiségű hulladékkal járhat a Windows 10 terméktámogatásának vége
- CPU léghűtés kibeszélő
- Mégsem búcsúznak a DDR4-es memóriák
- Apple MacBook
- Nagyon érzékeny lett a játékok archiválására a Nintendo
-
PROHARDVER!
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 #20003 üzenetére
A programmal lesz gond, nem a kapcsolóval, ez tuti.
Jelen állapotában, ha be van kötve a kapcsoló, akkor indulásnál, vagy amikor bedugom a kapcsolót, akkor kifagy
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*/
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) {
mindenRajtaVan();
gombNyomas++;
} else if (gombNyomas == 2) {
homeroVanRajta();
gombNyomas++;
} else if (gombNyomas == 3) {
gazVanRajta();
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(500);
/*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();
}
Serial.println(gombNyomas);
}Egyenlőre feladtam, kiszellőztetem a fejem.
Új hozzászólás Aktív témák
- Feltörték a PROHARDVER!-es regisztrációmat (vagy elvesztettem a belépési emailcímet, 2FA-t)
- Opel topik
- Bambu Lab 3D nyomtatók
- Milyen cserélhető objektíves gépet?
- Autós kamerák
- Xiaomi Smart Band 10 - a hetedik napon megpihen
- Audi, Cupra, Seat, Skoda, Volkswagen topik
- Milyen házat vegyek?
- Kerékpárosok, bringások ide!
- Gitáros topic
- További aktív témák...
- Nokia 105 4G (2023) charcoal, Nokia 110 4G (2023) midnight blue
- ASRock B550 PG Velocita + Ryzen 5 3600 + 32GB (4x8GB) DDR4 3600Mhz CL18
- Philips 58PUS8505 Smart LED Televízió,146 cm, 4K Ultra HD ,Android, Ambilight, HDR10+ KIJELZŐHIBÁSAN
- Canon EOS 250D kiegészítőkkel, táskával (CSAK 200 expoval !!! )
- Lenovo Legion Go 512GB + rengeteg extra!
- Samsung Galaxy S6 Lite (2022) , 4/64 GB ,Wi-fi
- 124 - Lenovo Yoga Pro 7 (14IMH9) - Intel Core Ultra 9 185H, RTX 4060 (48 hónap garancia!) (ELKELT)
- Bomba ár! Lenovo ThinkPad P50 - i7-HQ I 16GB I 256SSD I Nvidia I 15,6" FHD I Cam I W10 I Gari!
- Bomba ár! Dell Latitude 7320 - i5-11GEN I 8GB I 256SSD I HDMI I 13,3" FHD I Cam I W11 I Garancia!
- AKCIÓ! ASRock B85M Pro4 B85 chipset alaplap garanciával hibátlan működéssel
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest