View unanswered posts | View active topics It is currently Wed Dec 11, 2019 8:12 pm






Reply to topic  [ 3 posts ] 
Get red, green and blue values in clor sensor RGB mode 
Author Message
Rookie

Joined: Thu Apr 02, 2015 6:16 pm
Posts: 12
Post Get red, green and blue values in clor sensor RGB mode
Is there a way to get the r, g and b values of the color sensor through commands?
-I am using EV3


Sat May 02, 2015 6:36 pm
Profile
Rookie

Joined: Thu Apr 02, 2015 6:16 pm
Posts: 12
Post Re: Get red, green and blue values in clor sensor RGB mode
Actually i wanted a way to read the red, blue and green values at the same time, a way to access the values of the sensor in the green, blue and red mode.

The pseudo code would be like this:
Code:
Turn Sensor Green and read value;
Turn sensor blue and read value;
Turn sensor red and read value;


Do you know a way to code this?


Sun May 03, 2015 8:13 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Get red, green and blue values in clor sensor RGB mode
You can fetch all the information in one go 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
Display posts from previous:  Sort by  
Reply to topic   [ 3 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:  



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