View unanswered posts | View active topics It is currently Fri Dec 09, 2016 12:05 am






Reply to topic  [ 1 post ] 
how to use different mode of color sensor (Color/Reflected) 
Author Message
Rookie

Joined: Wed Mar 30, 2016 12:18 pm
Posts: 1
Post how to use different mode of color sensor (Color/Reflected)
Hi,

i like to read the reflected Value and the color green.

Code:
#pragma config(Sensor, S2,     colorR,         sensorEV3_Color)
#pragma config(Sensor, S3,     colorL,         sensorEV3_Color)
#pragma config(Motor,  motorB,           ,             tmotorEV3_Large, PIDControl, reversed, driveRight, encoder)
#pragma config(Motor,  motorC,           ,             tmotorEV3_Large, PIDControl, reversed, driveLeft, encoder)


task main()
{
        float colorLeft ;
        float colorRight;

        float reflectedLeft;
        float reflectedRight;

while(true){
        setSensorMode(colorR,modeEV3Color_Color);
        setSensorMode(colorL,modeEV3Color_Color);
        sleep( ?? ); // ???? ####               #####  <=  ###[color=#FF0000] How much time do i need minimum?  [/color]###
        colorLeft  = SensorValue[colorL];
        colorRight = SensorValue[colorR];
       
        setSensorMode(colorR,modeEV3Color_Reflected);
        setSensorMode(colorL,modeEV3Color_Reflected);
       [color=#FF0000] sleep( ?? ); // ???? ####               #####[/color]
        reflectedLeft =SensorValue[colorL];
        reflectedRight =SensorValue[colorR];

       

       if(reflectedLeft >90){
        //stop motor B and C
       }else{
         //motor B and C on
     }
      if(colorLeft==3){ //green
       //go Left
      }
      if(colorRight ==3){ //green
       //go Right
      }
 }

}


Wed Mar 30, 2016 12:55 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

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.