Hirdetés
- Ezek a OnePlus 12 és 12R európai árai
- Apple iPhone 17 Pro Max – fennsík
- iPhone topik
- Milyen okostelefont vegyek?
- Honor Magic6 Pro - kör közepén számok
- Vivo X300 - kicsiben jobban megéri
- Örömkönnyek és üres kezek a TriFold startjánál
- Xiaomi 14T Pro - teljes a család?
- Megbüntették, ezért feloszlatná az EU-t Elon Musk
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
-
Mobilarena
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
-
Undoroid
őstag
válasz
Undoroid
#16856
üzenetére
Sziasztok!
Nos, elakadtam és ismét kérdeznék.

A példafeladatot módosítva idáig jutottam el:
/***********************************************************File name: 09_rgbLed.inoDescription:Control the RGB LED emitting red, green, blue, yellow,white and purple light, then the RGB LED will be off,each state continues 1s, after repeating the aboveprocedure.Website: www.adeept.comE-mail: support@adeept.comAuthor: TomDate: 2015/05/02*************************************************************/int redPin = 11; // R petal on RGB LED module connected to digital pin 11int greenPin = 10; // G petal on RGB LED module connected to digital pin 9int bluePin = 9; // B petal on RGB LED module connected to digital pin 10int red2Pin = 6; // R petal on RGB LED module connected to digital pin 6int green2Pin = 5; // G petal on RGB LED module connected to digital pin 5int blue2Pin = 3; // B petal on RGB LED module connected to digital pin 3void setup(){pinMode(redPin, OUTPUT); // sets the redPin to be an outputpinMode(greenPin, OUTPUT); // sets the greenPin to be an outputpinMode(bluePin, OUTPUT); // sets the bluePin to be an outputpinMode(red2Pin, OUTPUT); // sets the redPin to be an outputpinMode(green2Pin, OUTPUT); // sets the greenPin to be an outputpinMode(blue2Pin, OUTPUT); // sets the bluePin to be an output}void loop() // run over and over again{// Basic colors:color(255, 0, 0); // turn the RGB LED reddelay(1000); // delay for 1 secondcolor(0,255, 0); // turn the RGB LED greendelay(1000); // delay for 1 secondcolor(0, 0, 255); // turn the RGB LED bluedelay(1000); // delay for 1 second// Example blended colors:color(255,255,0); // turn the RGB LED yellowdelay(1000); // delay for 1 secondcolor(255,255,255); // turn the RGB LED whitedelay(1000); // delay for 1 secondcolor(128,0,255); // turn the RGB LED purpledelay(1000); // delay for 1 secondcolor(0,0,0); // turn the RGB LED offdelay(1000); // delay for 1 second}void color (unsigned char red, unsigned char green, unsigned char blue)// the color generating function{analogWrite(redPin, 255-red); // PWM signal outputanalogWrite(greenPin, 255-green); // PWM signal outputanalogWrite(bluePin, 255-blue); // PWM signal outputanalogWrite(red2Pin, 255-red); // PWM signal outputanalogWrite(green2Pin, 255-green); // PWM signal outputanalogWrite(blue2Pin, 255-blue); // PWM signal output}Annyit tettem, hogy lemásoltam / megdupláztam a megfelelő parancssorokat és más neveket is adtam nekik. Ekkor a 9-10-11-es kimenet és a 3-5-6-os kimenet pontosan ugyanazokat a jeleket produkálták. Amikor ezt a sort (
void color (unsigned char red, unsigned char green, unsigned char blue)// the color generating function{) kezdtem el ugyanúgy lemásolni / módosítani, akkor viszont megannyi hibaüzenet fogadott feltöltés közben. Megpróbáltam kiegészíteni ilyenre is:void color (unsigned char red, unsigned char green, unsigned char blue, unsigned char red2, unsigned char green2, unsigned char blue2)// the color generating function
Erre szintén újabb hibaüzenettel gazdagodtam...
A feladatom az lenne, hogy a 3-5-6-os kimeneten és a 9-10-11-es kimeneten egyidőben, de különböző jeleket (sima RGB-LED-es színkeveréseket és villogásokat) szeretnék futtatni. A nagy kérdés pedig az, hogy hogyan?

A színek létrehozása, keverése, átúsztatása (a color - delay párossal) "megy" , de nem a legszebb- és a legjobb tárhelyhasználattal, de működik!
A fő problémám az, hogy nem tudom külön-külön kezelni a két kimenetet. Nem tudok olyan parancssort létrehozni, ami ezt megoldaná.Remélem, hogy tudtok segíteni?!

Új hozzászólás Aktív témák
- Bluetooth hangszórók
- The Game Awards 2025 - Íme a nyertesek!
- Irodát kért, de gyárat kapott Elon Musk a Samsungtól
- Ezek a OnePlus 12 és 12R európai árai
- The Game Awards 2025 - Az összes bejelentés egy helyen!
- Metal topik
- Audi, Cupra, Seat, Skoda, Volkswagen topik
- OLED TV topic
- Házimozi belépő szinten
- Milyen TV-t vegyek?
- További aktív témák...
- Telefon felvásárlás!! iPhone 11/iPhone 11 Pro/iPhone 11 Pro Max
- HIBÁTLAN iPhone 15 Pro Max 256GB Natural Titanium-1 ÉV GARANCIA - Kártyafüggetlen, MS4231
- Asus TUF Gaming F15 FX507 - 15,6"FHD 144Hz - i5-12500H - 8GB - 512GB SSD - RTX 3050 - 1 év garancia
- Telefon felvásárlás!! iPhone 16/iPhone 16 Plus/iPhone 16 Pro/iPhone 16 Pro Max
- Xiaomi 13T Dobozzal Töltővel
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: BroadBit Hungary Kft.
Város: Budakeszi




ekkold

