RobotBASIC CG Demo 1

February 6, 2009

I have a pre-release of RobotBASIC that I’ve been playing with. The free, powerful RobotBASIC will soon support the U401 and U421. I’ve made sample code using RobotBASIC that gets some version information from the DLL that communicates with an attached U401/U421, then gets a serial number from each device.

RobotBASIC Demo 1

RobotBASIC Demo 1

The RobotBASIC version with USBmicro support will be released soon.

The RobotBASIC code (below) is reasonably self-explanatory and shows how easy it is to communicate with the U401/U421 with support built in for these USBmicro devices.

//---------------------------------------------------------------------------
//
// Main Program
//
//---------------------------------------------------------------------------

MainProgram:

    // Allow screen double buffering
    Flip On

    //---------------------------
    // Get information for DLL
    //---------------------------

    xyText 5, 20, "USBmicro DLL Data", "Verdana", 15, fs_Bold|fs_Underlined

    m = usbm_DLLSpecs()

    //---------------------------
    // Display discovered information
    //---------------------------

    // About this DLL
    xyText 25, 60, "About:" + Extract(m,"|",1), "Verdana", 10

    // DLL Version and Date
    xyText 25, 80, "DLL Version: " + Extract(m,"|",4), "Verdana", 10
    xyText 25, 100, "DLL Version date: " + Extract(m,"|",3), "Verdana", 10

    //---------------------------
    // Get information about
    // connected devices.
    //---------------------------

    // Discover the devices
    n = usbm_finddevices()

    // Count devices
    n = usbm_numberofdevices()
    m = ""
    if n != 1 then m = "s"
    xyText 5, 150, "Found " + n + " Device" + m, "Verdana", 10

    // Display devices
    xyText 5, 180, "Device", "Verdana", 10, fs_Bold|fs_Underlined
    xyText 80, 180, "Made By", "Verdana", 10, fs_Bold|fs_Underlined
    xyText 220, 180, "Type", "Verdana", 10, fs_Bold|fs_Underlined
    xyText 300, 180, "Serial Number", "Verdana", 10, fs_Bold|fs_Underlined

    // Loop through all of the devices
    for loop = 1 to n

        // Get device info
        m = usbm_DeviceSpecs(loop - 1)

        // Print device info
        xyText 5, 190 + (20 * loop), loop, "Verdana", 10
        xyText 80, 190 + (20 * loop), extract(m,"|",4), "Verdana", 10
        xyText 220, 190 + (20 * loop), extract(m,"|",5), "Verdana", 10
        xyText 300, 190 + (20 * loop), extract(m,"|",6), "Verdana", 10

    next loop

    // Show buffered screen
    flip

End

=Gizmo=

Leave a Reply

You must be logged in to post a comment.