示例#1
0
int main(int argc, char* argv[])
{    
    Controller c;

    if (!c.connectDevice(1)) {
        std::cerr << "Connection established" << std::endl;
        return EXIT_FAILURE;
    }
    
    Device *dc = c.getConnectedDevice();
    dc->on(4,4,4);
    dc->on(3,4,4);
    dc->on(4,3,4);
    dc->on(5,4,4);
    dc->on(4,5,4);
    dc->on(3,3,4);
    dc->on(5,5,4);

    std::cout << "DeviceShape on (4,4,4)" << std::endl;
    
    c.display();
    std::cout << "DeviceShape displayed" << std::endl;

    c.disconnectDevice();
    return 0;
}
示例#2
0
int main(int argc, char** argv) {
    
    Controller c;
    c.connectDevice(1);
    
    Ball b;
    
    c.getConnectedDevice()->setLedStatus(b);

    for (int i = 0; i < 100; i++) {
        b.action();
        c.getConnectedDevice()->setLedStatus(b);
        
        c.display();
        //nanosleep(TIME, NULL);
        sleep(2);
    }
    c.disconnectDevice();
    return 0;
}