i creating skittle sorting machine school , having trouble completing program.
i new arduino, shouldn't overly difficult.
i using following program sense colors... , works.
my question how implement "if then" statement 'if colors within range, call color, , move servo location".
i new arduino, shouldn't overly difficult.
i using following program sense colors... , works.
my question how implement "if then" statement 'if colors within range, call color, , move servo location".
code: [select]
#include <wire.h>
#include "sfe_isl29125.h"
// declare sensor object
sfe_isl29125 rgb_sensor;
void setup()
{
// initialize serial communication
serial.begin(115200);
// initialize isl29125 simple configuration starts sampling
if (rgb_sensor.init())
{
serial.println("sensor initialization successful\n\r");
}
}
// read sensor values each color , print them serial monitor
void loop()
{
// read sensor values (16 bit integers)
unsigned int red = rgb_sensor.readred();
unsigned int green = rgb_sensor.readgreen();
unsigned int blue = rgb_sensor.readblue();
// print out readings, change hex dec if prefer decimal output
serial.print("red: "); serial.println(red,dec);
serial.print("green: "); serial.println(green,dec);
serial.print("blue: "); serial.println(blue,dec);
serial.println();
delay(2000);
}
it arduino uno
Arduino Forum > Using Arduino > Programming Questions > skittle sorter program "if then statement help"
arduino
Comments
Post a Comment