Skip to content

Instantly share code, notes, and snippets.

@zardam
zardam / usb.c
Created April 7, 2019 23:20
Small libusb test program to send querie to a TI-Python module
// gcc usb.c `pkg-config --libs --cflags libusb-1.0
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <libusb.h>
static struct libusb_device_handle *devh = NULL;
static int open_device(void) {
import uart
def py_bot():
s = uart.writeLine
s("\x01") # raw mode
s("""r.println("Hello from NW !")
utime.sleep(5)
while True:
r.motor_speed(50, 50)
while r.distance_in_cm() > 30:
utime.sleep(.01)