Example code using rgb_sensor_detection to detect coffee capsule colours.

Dependencies:   mbed rgb_sensor_detection

main.cpp

Committer:
bjblazkowicz
Date:
2014-07-03
Revision:
0:057d26b75cec

File content as of revision 0:057d26b75cec:

/* Discrete RGB color sensor
 *
 * - uses single-channel light-dependent resistor (via ADC)
 *   and a RGB LED.
 * -  compensates background light
 *
 * Copyright (c) 2014 ARM Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <mbed.h>
#include <detection.h>

Serial console(USBTX, USBRX);

int main() 
{   
    RGB_Detection detector(p23,p24,p25,p20);
    
    console.baud(115200);
    
    while (1) 
    {
        const char* name = detector.run(); 
        console.printf("%s\r\n", name);
    }

    return 0;
}