QTI Sensors problem on Propeller Activity Board
STiGMa
Posts: 7
Hi,
I recently bought a set of QTI line following sensor to use it on a project with my ActivityBot. After following the mounting instructions coming with the kit, I used the C code I found on the forum (also shown below).
However, the left servo does not operate as expected; it is static and is not moving whatever the case.
I debugged the servos independently (without using the QTI sensors) and invoked both drive_speed(...) and drive_goto(...). Both servos work fine.
I also checked the input from the QTI sensors independently (without invoking the drive_xxx function) and the sensors provide the expected output.
When I run the code below, however, the left servo is not working. Any ideas what might be the problem?
I recently bought a set of QTI line following sensor to use it on a project with my ActivityBot. After following the mounting instructions coming with the kit, I used the C code I found on the forum (also shown below).
However, the left servo does not operate as expected; it is static and is not moving whatever the case.
I debugged the servos independently (without using the QTI sensors) and invoked both drive_speed(...) and drive_goto(...). Both servos work fine.
I also checked the input from the QTI sensors independently (without invoking the drive_xxx function) and the sensors provide the expected output.
When I run the code below, however, the left servo is not working. Any ideas what might be the problem?
#include "simpletools.h" // Include libraries #include "abdrive.h" int getQTIs(int highPin, int lowPin); // Forward declare function int main() // Main function { while(1) // Main loop { int qtis = getQTIs(10, 7); print("QTIs = %02b \n", qtis); // QTI detections as binary val // Check stripe position if(qtis == 0b1000) drive_speed(-64, 64); // Far left, rotate left if(qtis == 0b1100) drive_speed(0, 64); // Left, pivot left if(qtis == 0b0100) drive_speed(32, 64); // A little left, curve left if(qtis == 0b0110) drive_speed(64, 64); // Stripe centered, forward if(qtis == 0b0010) drive_speed(64, 32); // A little right, curve right if(qtis == 0b0011) drive_speed(64, 0); // Right, pivot right if(qtis == 0b0001) drive_speed(64, -64); // Far right, rotate right } } int getQTIs(int highPin, int lowPin) // Function - getQTIs { int dt = (CLKFREQ / 1000000) * 230; // Set up 230 us time increment set_outputs(highPin, lowPin, 0b1111); // highPin...lowPin set high set_directions(highPin, lowPin, 0b1111); // highPin...lowPin set to output waitcnt(dt + CNT); // Wait 230 us set_directions(highPin, lowPin, 0b0000); // highPin...lowPin st to input waitcnt(dt + CNT); // Wait 230 us int qtis = get_states(highPin, lowPin); // Get 4-bit pattern QTIs apply return qtis; // Return val containing pattern }
Comments
However, the problem is still the same, i.e., reading the QTIs and driving the activityBot do not work well together.