Welcome!

IR Seeker and Code

  • 17 Dec 2013 10:17 AM
    Message # 1459714
    Shari (Administrator)

    For the autonomous portion, the IR seeker shoul be able to find the sensor.  The sensor and its accompanying code can be found at http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NSK1042

     

    //=====================================================================
    // Sample Program to display the values from the
    // HiTechnic IRSeeker V2
    //
    #define IRSEEKER IN_1
    
    // Convenience macro that combines TextOut and NumOut
    #define TextNumOut(xPos,yPos,str,col,num)  TextOut(xPos,yPos,str); \
                                               NumOut(xPos+6*col,yPos,num)
    
    task main()
    {
      int dir, s1, s2, s3, s4, s5, result;
    
      SetSensorLowspeed(IRSEEKER);
      
      while(true) {
        ReadSensorHTIRSeeker2AC(IRSEEKER, dir, s1, s2, s3, s4, s5);
    
        TextNumOut(0, LCD_LINE3, "Dir:    ",4,dir);
        TextNumOut(6, LCD_LINE4, "S1:     ",3,s1);
        TextNumOut(6, LCD_LINE5, "S2:     ",3,s2);
        TextNumOut(6, LCD_LINE6, "S3:     ",3,s3);
        TextNumOut(6, LCD_LINE7, "S4:     ",3,s4);
        TextNumOut(6, LCD_LINE8, "S5:     ",3,s5);
    
        Wait(100);
      }
    }
    
    
    Last modified: 17 Dec 2013 10:18 AM | Shari (Administrator)
© Lord of the Bricks
Powered by Wild Apricot. Try our all-in-one platform for easy membership management