View unanswered posts | View active topics It is currently Sun Dec 08, 2019 8:54 am






Reply to topic  [ 5 posts ] 
In Ev3 what does the getColorRGBChannels do? 
Author Message
Rookie

Joined: Thu Apr 02, 2015 6:16 pm
Posts: 12
Post In Ev3 what does the getColorRGBChannels do?
Code:
#pragma config(Sensor, S1,     cDir,           sensorEV3_Color, modeEV3Color_Color)
#pragma config(Sensor, S2,     cEsq,           sensorEV3_Color)
#pragma config(Sensor, S3,     uFre,           sensorEV3_Ultrasonic)
#pragma config(Motor,  motorB,          mDir,          tmotorEV3_Large, PIDControl, encoder)
#pragma config(Motor,  motorC,          mEsq,          tmotorEV3_Large, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//int i = 0;

task main()
{
   setSensorMode(cDir, 2);
   while(1){
    wait1Msec(200);
    getColorRGBChannels(cDir, &pRedChannel, &pGreenChannel, &pBlueChannel)
    //displayTextLine(3, "%d", SensorValue(cDir));
   }

}


the compiler says :
**Error**:Undefined procedure 'getColorRGBChannels'.
**Error**:Undefined variable 'pRedChannel'. 'short' assumed.
**Error**:Undefined variable 'pGreenChannel'. 'short' assumed.
**Error**:Undefined variable 'pBlueChannel'. 'short' assumed.

But i saw this command in the help section, why it is not working?


Sun May 03, 2015 8:35 pm
Profile
Rookie

Joined: Thu Apr 02, 2015 6:16 pm
Posts: 12
Post Re: In Ev3 what does the getColorRGBChannels do?
I found this command in the help part, but i think it does nothing, the correct command might be getColorRGB, and it gets the r, g and b values.


Sun May 03, 2015 11:17 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: In Ev3 what does the getColorRGBChannels do?
You can use it like this:
Code:
#pragma config(Sensor, S1,     COLOUR,         sensorEV3_Color, modeEV3Color_Color)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
  long red, green, blue;
  while (true)
  {
    getColorRGB(COLOUR, red, green, blue);
    displayTextLine(2, "R: %d", red);
    displayTextLine(3, "G: %d", green);
    displayTextLine(4, "B: %d", blue);
    sleep(50);
  }
}

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon May 04, 2015 12:01 am
Profile WWW
Rookie

Joined: Thu Apr 02, 2015 6:16 pm
Posts: 12
Post Re: In Ev3 what does the getColorRGBChannels do?
Yeah :D it worked!
Thanks Xander!


Mon May 04, 2015 5:40 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: In Ev3 what does the getColorRGBChannels do?
Glad to hear it :)

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon May 04, 2015 6:00 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.