Hirdetés
- Megtartotta Európában a 7500 mAh-t az Oppo
- Fotók, videók mobillal
- Google Pixel topik
- Xiaomi 15T - reakció nélkül nincs egyensúly
- Xiaomi 15 - kicsi telefon nagy energiával
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Hivatalos a OnePlus 13 startdátuma
- Yettel topik
- Fordulat: időben startol S26+, nézd meg, milyen lesz!
- Miért fárad gyorsabban az iPhone akku, mint az androidos?
-
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
- BESZÁMÍTÁS! ASUS H510M i5 10500T 16GB DDR4 512GB SSD RX 5500 XT 8GB Zalman T4 Plus Chieftec 600W
- Magic Trackpad legújabb fajta, lightning csatlakozóval
- Telefon felvásárlás!! iPhone 15/iPhone 15 Plus/iPhone 15 Pro/iPhone 15 Pro Max
- MSI CreatorPro Z16P RTX A5500 TOUCH! (vapor chamberrel)
- Apple iPhone 12 64GB / Kártyafüggetlen / 12Hó Garancia / 100% akku
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopműhely Bt.
Város: Budapest




ekkold

