Tag Info

New answers tagged

1

A temporary fix I found that works: using the provided "gray blobs", there is one named "PBRStringAtIndex" (or something like that) which will indeed compile (EV3 only). This does not address the similar "write at index" issue, and the output is a "byte" (presumably ASCII), not text. (I will update this answer as I find out more.)


0

The command that you are looking for is setMotorTarget as shown in the documentation here. Essentially, you need to set the target rotation for the motor in degrees and then wait for the movement to take place: //Sets motorA target to 50 degrees at a speed of 100 setMotorTarget(motorA, 50, 100); // Waits for movement to complete ...


2

You can do this with parallel programs and a logic variable. You will need 3 loops, one for each sensor and one for the motor. In the sensor loops, wait for the touch sensor to be pressed and then set a logic variable to true. In the motor loop, have a switch block that tests the logic variable. If it is true, reverse and turn around and then set the logic ...


0

Here is my code that gets raw RGB data: #define COLORSENSOR SENSOR_3 #define S_CLR IN_3 #define FLT_MAX #define FLT_MIN unsigned int rgbn[4]; void color_sensor_on() { SetSensorColorFull(S_CLR); ResetSensor(S_CLR); } task main(){ color_sensor_on(); while(true) { ReadSensorColorRaw(S_CLR, rgbn); ...


2

Not sure what language you are using, or calls you are making before this, but: float var_Min = var_R; if (var_G > var_Min) var_Min = var_G; if (var_B > var_Min) var_Min = var_B; Should be (note the use of < rather than >) float var_Min = var_R; if (var_G < var_Min) var_Min = var_G; if (var_B < var_Min) var_Min = var_B; Your posted code ...


0

The following works if you just want the builtin six/seven colors, without any calibration. task main() { SetColorSensorFull(S3); while(true){ int value=Sensor(S3); // value now contains 1 for black, 2 for blue, 3 for green, 4 for yello, 5 for red, 6 for white, and something else for an unknown color. } However, if you want to do ...


0

I'm not entirely sure if you need the raw data, but if you're just looking to read the different colour values, there is a much easier way. To turn on and set up the sensor, use SetSensorColorFull(S3);. Then to retrieve the value just use Sensor(S3). The value returned will be an integer from 1 to 6, corresponding to the following colour values: 1 = black ...



Top 50 recent answers are included