- Android alkalmazások - szoftver kibeszélő topik
- Milyen okostelefont vegyek?
- Olcsó Galaxyk telepíthetik a One UI 7-et
- Bemutatkozott a Poco X7 és X7 Pro
- iGO Primo
- Samsung Galaxy S21 FE 5G - utóirat
- Fotók, videók mobillal
- Apple Watch
- Xiaomi Watch 2 Pro - oké, Google, itt vagyunk mi is
- Redmi 9 - sok bába közt elvész a gyerek
-
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.ino
Description: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 above
procedure.
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2015/05/02
*************************************************************/
int redPin = 11; // R petal on RGB LED module connected to digital pin 11
int greenPin = 10; // G petal on RGB LED module connected to digital pin 9
int bluePin = 9; // B petal on RGB LED module connected to digital pin 10
int red2Pin = 6; // R petal on RGB LED module connected to digital pin 6
int green2Pin = 5; // G petal on RGB LED module connected to digital pin 5
int blue2Pin = 3; // B petal on RGB LED module connected to digital pin 3
void setup()
{
pinMode(redPin, OUTPUT); // sets the redPin to be an output
pinMode(greenPin, OUTPUT); // sets the greenPin to be an output
pinMode(bluePin, OUTPUT); // sets the bluePin to be an output
pinMode(red2Pin, OUTPUT); // sets the redPin to be an output
pinMode(green2Pin, OUTPUT); // sets the greenPin to be an output
pinMode(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 red
delay(1000); // delay for 1 second
color(0,255, 0); // turn the RGB LED green
delay(1000); // delay for 1 second
color(0, 0, 255); // turn the RGB LED blue
delay(1000); // delay for 1 second
// Example blended colors:
color(255,255,0); // turn the RGB LED yellow
delay(1000); // delay for 1 second
color(255,255,255); // turn the RGB LED white
delay(1000); // delay for 1 second
color(128,0,255); // turn the RGB LED purple
delay(1000); // delay for 1 second
color(0,0,0); // turn the RGB LED off
delay(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 output
analogWrite(greenPin, 255-green); // PWM signal output
analogWrite(bluePin, 255-blue); // PWM signal output
analogWrite(red2Pin, 255-red); // PWM signal output
analogWrite(green2Pin, 255-green); // PWM signal output
analogWrite(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
- Filmvilág
- AMD Ryzen 9 / 7 / 5 / 3 5***(X) "Zen 3" (AM4)
- Lakáshitel, lakásvásárlás
- EAFC 25
- Luck Dragon: Asszociációs játék. :)
- Hisense LCD és LED TV-k
- NVIDIA GeForce RTX 3080 / 3090 / Ti (GA102)
- Formula-1
- Android alkalmazások - szoftver kibeszélő topik
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- További aktív témák...
- BESZÁMÍTÁS! Asus B760M i7 12700KF 32GB DDR4 512GB SSD RX 6800 16GB Rampage SHIVA FSP 700W
- BESZÁMÍTÁS! Gigabyte A620M R5 7500F 32GB DDR5 512GB SSD RX 6700 XT 12GB ZALMAN S3 TG CM 700W
- BESZÁMÍTÁS! MSI B450M R7 5700X 16GB DDR4 512GB SSD RTX 3060 12GB Rampage SHIVA Chieftec 600W
- AM4-es félkonfig, 5800X, 32gb Ram, B450, BeQuiet TF, FractalDesign Meshify C, Seasonic 650W
- BESZÁMÍTÁS! Asus TUF B550M R7 5700X 16GB DDR4 512GB SSD RTX 3060 Ti 8GB Rampage SHIVA FSP 700W
- AKCÓÓÓ!!! Panasonic CF-XZ6 AIO all-in-one laptop tablet 2k touch i5-7300u speciális ütésálló
- Samsung Galaxy S23 Plus 256 GB Kártyafüggetlen 1Év Garanciával
- Telefon felvásárlás!! iPhone X/iPhone Xs/iPhone XR/iPhone Xs Max
- Xiaomi Redmi 10 128GB, Kártyafüggetlen, 1 Év Garanciával
- DELL PowerEdge R730xd 16LFF+2SFF rack szerver - 2xE5-2680v3,64GB RAM,4x1GbE,H730 RAID v ZFS
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged