View unanswered posts | View active topics It is currently Thu Jun 21, 2018 4:46 am






Reply to topic  [ 4 posts ] 
Friendly Color Detection Sample Code - not the RGB version 
Author Message
Rookie

Joined: Tue Oct 22, 2013 11:00 am
Posts: 15
Location: Texas
Post Friendly Color Detection Sample Code - not the RGB version
Not sure if this is a sample code error or a RobotC error

Downloaded this to our robot to check colors on props for competition.

The color sensor cycles through a range of colors turning on and off

The display readout never shows anything except that the code is running and the flashing green lights on the brick.

Robot has a single color sensor and the ultrasonic sensor.

Ports are verified - sensor is configured - but even after flashing the firmware and reloading the code, there is no reading ever showing up on the display.


IDEAS?


Wed Oct 29, 2014 10:39 am
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post Re: Friendly Color Detection Sample Code - not the RGB ver
What does your code look like? Could you please post it in between [_code] and [_/code] tags (without the underscores) so we could take a look at it?

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Wed Oct 29, 2014 11:00 am
Profile
Rookie

Joined: Tue Oct 22, 2013 11:00 am
Posts: 15
Location: Texas
Post Re: Friendly Color Detection Sample Code - not the RGB ver
code
#pragma config(Sensor, S1, UPPCOLOR, sensorEV3_Color)
#pragma config(Sensor, S2, LOWERCOLOR, sensorEV3_Color)
#pragma config(Sensor, S4, sonarSensor, sensorEV3_Ultrasonic)
#pragma config(Motor, motorA, armMotor, tmotorEV3_Large, PIDControl, encoder)
#pragma config(Motor, motorB, leftMotor, tmotorEV3_Large, PIDControl, driveLeft, encoder)
#pragma config(Motor, motorC, rightMotor, tmotorEV3_Large, PIDControl, driveRight, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*
Motor Ports:
A = Arm Motor
B = Right Motor
C = Left Motor
*/

task main()
{
TLegoColors colour = colorNone;

while (true)
{
colour = getColorName(UPPCOLOR);

writeDebugStream("Colour detected: ");
switch(colour)
{
case colorNone: writeDebugStreamLine("none"); break;
case colorBlack: writeDebugStreamLine("black"); break;
case colorBlue: writeDebugStreamLine("blue"); break;
case colorGreen: writeDebugStreamLine("green"); break;
case colorYellow: writeDebugStreamLine("yellow"); break;
case colorRed: writeDebugStreamLine("red"); break;
case colorWhite: writeDebugStreamLine("white"); break;
case colorBrown: writeDebugStreamLine("brown"); break;
default: writeDebugStreamLine("unknown");
}
sleep(100);
}
return;
}

/code


Wed Oct 29, 2014 11:17 am
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post Re: Friendly Color Detection Sample Code - not the RGB ver
The code that you have prints information to the debug stream in ROBOTC, not to the EV3 screen. To view the debug stream, you will have to open it under the menu Robot->Debugger Windows->Debug Stream. To actually print to the EV3's screen, you'll have to use one of the commands found here. The commands listed here are under the NXT section of the help, but I believe they're the same for the EV3.

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Wed Oct 29, 2014 3:22 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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.