- gban: Ingyen kellene, de tegnapra
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- sziku69: Fűzzük össze a szavakat :)
- 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
- Argos: Szeretem az ecetfát
- 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
-
lanszelot
addikt
Hello,
C++ function létrehozással - meghívással gondom van
mivel még sohase csináltam, csak próbálgatom, de valami nem jó
#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*/
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);
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() {
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*/
/*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++;
}
if (gombAllapot > 3) {
gombNyomas = 1;
}
switch(gombAllapot) {
case 1:
mindenRajtaVan();
break;
case 2:
homeroVanRajta();
break;
case 3:
gazVanRajta();
break;
}
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);
}
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*/
}
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*/
}hiba üzenet:
C:\Users\robag\Documents\Arduino\gas_homero_gomb_nano\gas_homero_gomb_nano.ino: In function 'void loop()':
gas_homero_gomb_nano:56:25: error: a function-definition is not allowed here before '{' token
void mindenRajtaVan() {
^
gas_homero_gomb_nano:88:25: error: a function-definition is not allowed here before '{' token
void homeroVanRajta() {
^
gas_homero_gomb_nano:106:22: error: a function-definition is not allowed here before '{' token
void gazVanRajta() {
^
gas_homero_gomb_nano:130:5: error: 'mindenRajtaVan' was not declared in this scope
mindenRajtaVan();
^~~~~~~~~~~~~~
gas_homero_gomb_nano:133:5: error: 'homeroVanRajta' was not declared in this scope
homeroVanRajta();
^~~~~~~~~~~~~~
gas_homero_gomb_nano:136:5: error: 'gazVanRajta' was not declared in this scope
gazVanRajta();
^~~~~~~~~~~
Multiple libraries were found for "Wire.h"
Used: C:\Users\robag\AppData\Local\Arduino15\packages\ATmega328PB-incl-Bootloader\hardware\avr\0.1.0\libraries\Wire
Not used: C:\Users\robag\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire
Multiple libraries were found for "SPI.h"
Used: C:\Users\robag\AppData\Local\Arduino15\packages\ATmega328PB-incl-Bootloader\hardware\avr\0.1.0\libraries\SPI
Not used: C:\Users\robag\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SPI
exit status 1
a function-definition is not allowed here before '{' token
Új hozzászólás Aktív témák
Hirdetés
- PROHARDVER! feedback: bugok, problémák, ötletek
- gban: Ingyen kellene, de tegnapra
- Eredeti játékok OFF topik
- exHWSW - Értünk mindenhez IS
- Xbox Series X|S
- A Fehér Házban marad a Starlink Trump és Musk rossz kapcsolata ellenére
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- VR topik
- Egyre csak fejlődik az AI, emberek tízezreit rúgja majd ki a BT
- sziku69: Fűzzük össze a szavakat :)
- További aktív témák...
- 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
- Dell 27" UltraSharp U2713HM QHD 2560x1440 IPS DP/DVI/HDMI/VGA monitor - PIVOT is - több db
- Lejárt a gyártói garancia? Mi tovább támogatjuk az IT infrádat!
- LG 27GR93U-B - 27" IPS - UHD 4K - 144Hz 1ms - NVIDIA G-Sync - FreeSync Premium - HDR 400
- Acer Nitro 5 -AN515 - 15.6"FHD IPS 144Hz - i7-11800H - 16GB - 512GB SSD+1TB HDD -RTX 3050 - Garancia
- Huawei Nova Y70 128GB, Kártyafüggetlen, 1 Év Garanciával
- AKCIÓ! Gigabyte AORUS 16X (2024) Gamer notebook - i7 14650HX 16GB RAM 1TB SSD RTX 4070 8GBWin11
Állásajánlatok
Cég: PC Trade Systems Kft.
Város: Szeged
Cég: PC Trade Systems Kft.
Város: Szeged