Search code examples
pythonpython-3.xmsp430

How do I make my python script communicate with my MSP430 launchpad?


I want to create a GUI in python and make it interact with my micro-controller board(MSP430G2). Would like to know if there is any way to send/receive data between the two.


Solution

  • pip install python-msp430-tools
    
    if __name__ == '__main__':
        from msp430.util import hexdump
        import time
        mmc = MMC()
        try:
            mmc.connect()
            print mmc.info()
            #show what's there
            hexdump((0, mmc.read(0)))
            #speed test
            t1 = time.time()
            for n in range(10):
                mmc.read(n)
            t2 = time.time()
            dt = t2 - t1
            bytes = n * 512
            print "%d bytes in %.2f seconds -> %.2f bytes/second" % (bytes, dt, bytes/dt)
        finally:
            mmc.release()
    

    python-msp430-tools