lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Hi
Now that I have libusb working I am wanting to read string data from the usb port on the Raspberry Pi. The string looks like : (node sol_adv ? (p_1 0.00)(e_1 0.00)(p_2 0.00)(e_2 0.00)(p_3 0.00)(e_3 0.00)(p_4 0.00)(e_4 0.00))
(node sol_adv ? (temp_1 16.94) (temp_2 17.19) )
(node sol_adv ? (p_1 0.00)(e_1 0.00)(p_2 0.00)(e_2 0.00)(p_3 0.00)(e_3 0.00)(p_4 0.00)(e_4 0.00))
(node sol_adv ? (temp_1 16.94) (temp_2 17.19) )

as indicated using minicom

After a bit of reading I have played around with a few basic commands but really am just stabbing in the dark with my near zero knowledge of lua and limited programming skills.

require('libusb')
continuous=0
local buses=libusb.get_busses()
local handle=libusb.open(device)
libusb.bulk_read(handle, ENDPOINT_IN, ts, 1)

My hope is to get some basic code working and then try to merge it into a script that has been written to read from uart and push the data to a web site. I.e. replace the "read from uart" function. Doubtless some will respond with "go away" but from any patient/tolerant people out there prepared to help any tips or pointers would be much appreciated.

Thanks
Rob