Tag Info

New answers tagged

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); ...


0

NXC creates bytecode for the standard (or NXC upgraded) NXT virtual machine. The idea of this virtual machine is to create an abstraction layer to prevent malicious low level calls such as accessing memory registers on the processor. So, without a low level compiler, such access would not be possible.


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 ...


0

Control loops. The builtin RotateMotor commands are very imprecise. Have a look at this file for a nice library that makes skid steer vehicles turn very precisely: https://www.dropbox.com/s/o31qaxx0glx4m3x/Instacode.h?dl=0 You'll need to adjust the constants at the top of the file.



Top 50 recent answers are included