- sziku69: Fűzzük össze a szavakat :)
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- Magga: PLEX: multimédia az egész lakásban
- MasterDeeJay: Noname 1TB-os SATA SSD teszt
- hcl: MS Office365 Linuxon
- sziku69: Szólánc.
- Mr Dini: Mindent a StreamSharkról!
- Gurulunk, WAZE?!
- Luck Dragon: Asszociációs játék. :)
- Hieronymus: A németországi vasúthálózat
-
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
Hmmm, ez a baj. Nem tudtam a scope -ot.
Nem tudtam, hogy a loop -ból oda ki tud nyúlni.gombbal van most gond.
ha kikötöm, akkor is össze vissza nyomkodja magát. Azaz a gombnyomas valtozo értéke változik valamiért.#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 = 5; /*valtozo a gomb pin -nek*/
int gombAllapot = 0; /*valtozo a gomb allapot olvasasahoz*/
byte a = 0; /*valtozo a gaz erzekelo negyzet villogashoz*/
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*/
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);
void mindenRajtaVan() {
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(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.display(); /*to shows or update your TEXT*/
}
void gazVanRajta() {
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(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 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) {
gombNyomas++;
}
Serial.println(gombNyomas);
if (gombNyomas == 1) {
mindenRajtaVan();
} else if (gombNyomas == 2) {
homeroVanRajta();
} else if (gombNyomas == 3) {
gazVanRajta();
} else if (gombNyomas > 3) {
gombNyomas = 1;
}
}gombnyomas értéke:
MAX6675 test
1
2
2
2
3
3
4
2
2
3
4
1
2
2pedig nincs semmi az 5-ös pin-en.
Lehúztam.Amúgy hogyan kell a gombot helyesen bekötni?
Ahogy én gondoltam: negativ -> gomb -> 5-ös pin
Pozitív nélkül
Vagy nem földelni kell gombnyomáskor az 5-ös pint, hanem 3V vagy 5V-t adni neki gombnyomáskor?
Új hozzászólás Aktív témák
- Gigabyte B550M K épített PC Ryzen 5 5600G 64GB RAM
- Eladó egy Ezüst Macbook Pro M3 8Gb/500Gb, Francia bill,20Ciklus, 1év Apple garival
- Eladó egy Ezüst Macbook Pro M3 8Gb/500Gb, Arab bill, 3Ciklus, 1év Apple garival
- Intel Core i7 6700K / GTX 1660TI / 16GB DDR4 RAM / 500 GB SSD konfig eladó
- Eladó egy Macbook Pro M3 8Gb/1TB, Német bill, 2Ciklus, 1év Apple garanciával
- Xiaomi Redmi 9A 32GB Kártyafüggetlen 1Év Garanciával
- Nintendo Switch Pro Controller (19000 Ft / db)
- REFURBISHED és ÚJ - HP Thunderbolt Dock G2 230W docking station (3TR87AA)
- BESZÁMÍTÁS! Asus B550M R5 5600X 32GB DDR4 512GB SSD RTX 3060 12GB THERMALTAKE Commander G41 700W
- Bomba ár! Dell Latitude E7250 - i5-5GEN I 8GB I 256SSD I 12,5" HD I HDMI I Cam I W10 I Garancia!
Állásajánlatok
Cég: Promenade Publishing House Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest