Esempio n. 1
0
int nxtClose()
{
	motorMove(OUT_ABC, 0);

	libusb_release_interface(dev_handle, 0);
	libusb_close(dev_handle);
	libusb_exit(ctx);

	return 0;
}
Esempio n. 2
0
void timer0_int_handler() {
    WriteTimer0(0);
//    unsigned int val;
//    int length, msgtype;

    // toggle an LED
#ifdef __USE18F2680
    LATBbits.LATB0 = !LATBbits.LATB0;
#endif
    // reset the timer
    
    // try to receive a message and, if we get one, echo it back
//    length = FromMainHigh_recvmsg(sizeof(val), (unsigned char *)&msgtype, (void *) &val);
//    if (length == sizeof (val)) {
//        ToMainHigh_sendmsg(sizeof (val), MSGT_TIMER0, (void *) &val);
//    }

    //unsigned char motorcomm[2] = {0x9F, 0x1F};
#ifdef MOTORPIC
    distMoved++;
    if(distMoved >= distDesired){

        unsigned char motormsg[5] = {0x04, 0x00, 0x00, 0x00, 0x00};
        motormsg[1] = distMoved;
        motormsg[2] = (distMoved & 0x17);
        start_i2c_slave_reply(5, motormsg);

        distMoved = 0;
        unsigned char motorcomm[2] = {0x00, 0x00};
        motorMove(0x00, 0x00, 0);
    }
#endif
    
    //ConvertADC();
    //while( BusyADC()) {
        //LATBbits.LATB1 = 1;
    //}
    //LATBbits.LATB1 = 0;

    
}