|
I am trying to have a front sensor control a DC motor using the following code:
#include "mxapi.h"
void move (int count,int pulse_width[]) { int i; for (i=0; i<= count; i++) { RB3 = 1; delay_us (pulse_width [0]); RB3 = 0; RB0 = 1; delay_us (pulse_width [1]); RB0 = 0; delay_ms (20); } } void main (void) {
TRISC2 = 0; // SET PORT C2 LEFT MOTOR TRISD0 = 0; // SET PORT D0 LEFT MOTOR TRISC3 = 0; // SET PORT C3 LEFT MOTOR
TRISB3 = 0; TRISB0 = 0; adc_int(ALL_ANALOG); // INITIALIZE ANALOG INPUT
while(1==1) { if(adc_read (0)>=250) // IF PORT A0 VALUE >=250 { RC2 = 1; // LEFT MOTOR STOP RD0 = 0; RC3 = 0; } else if(adc_read (0)<250) // IF PORT A0 VALUE <250 { RC2 = 1; // LEFT MOTOR FORWARD RD0 = 0; RC3 = 1; } } }
I get an erro code of the following:
35: adc_int(0b00000000); ^ function declared implicit int (warning) : : undefined symbol: (error) : : _adc_int (motors2sensor.obj) (error)
any help would be great thanks
John |