Search found 7 matches

by dhallgb
Tue Apr 03, 2018 10:49 am
Forum: General Discussion and Questions
Topic: uctypes
Replies: 2
Views: 2356

Re: uctypes

I'm reading serial data from a weather station using a RS485-TTL interface. The communications data from the station is in packed format for which I only have a spreadsheet describing nibbles and bits. I don't have the corresponding C include which presumably is being used by the micro controller wi...
by dhallgb
Mon Apr 02, 2018 12:07 pm
Forum: General Discussion and Questions
Topic: uctypes
Replies: 2
Views: 2356

uctypes

I've finally understood the library uctypes, I think! I easily mapped the CPython comms protocol using the following: class RawWeatherData(BigEndianStructure): _pack_ = 1 _fields_ = [ ("FC", c_uint8, 8), ("SC", c_uint8, 8), ("DIR", c_uint8, 8), ("DIR8", c_uint8, 1), ("FIX", c_uint8, 2), ("WSP8", c_u...
by dhallgb
Fri Jun 09, 2017 9:35 pm
Forum: Drivers for External Components
Topic: Drivers for Waveshare 2.13inch E-Ink display
Replies: 57
Views: 64179

Re: Drivers for Waveshare 2.13inch E-Ink display

I wrote a small library for the 4.3inch Waveshare e-ink displays.
https://github.com/dhallgb/eInk-micropython

A lot larger display but easy to program.
I used the WiPy, it may work on the Pyboard.
by dhallgb
Sun Oct 16, 2016 7:06 pm
Forum: WiPy and CC3200 boards
Topic: Avoiding decimals when parsing json
Replies: 3
Views: 5461

Re: Avoiding decimals when parsing json

Thanks Jim, that sounds a really good idea. I've been going down the route of the parse_float handler and still encountering problems with argument num/types mismatch in the call. ujson.loads(weather_str, parse_float=parseFloat) Doing it manually like your code sounds a lot less painful, I'll give i...
by dhallgb
Thu Oct 13, 2016 7:29 pm
Forum: WiPy and CC3200 boards
Topic: Avoiding decimals when parsing json
Replies: 3
Views: 5461

Avoiding decimals when parsing json

When parsing the return from a weather service using the ujson module I get an error: ValueError: decimal numbers not supported Whilst I can use the round() function to return integers once I have the values, how can I avoid the parser throwing an error? pt1 = "http://api.openweathermap.org/data/2.5...
by dhallgb
Wed Oct 12, 2016 9:07 pm
Forum: WiPy and CC3200 boards
Topic: Extra character on UART
Replies: 3
Views: 4847

Re: Extra character on UART

Thank you for that suggestion which was correct and led me to bytearrays, the ustruct module and fun with 'pack_into'. My library for the Waveshare e-ink display running on the WiPy is at https://github.com/dhallgb/eInk-micropython - it may also work on others such as the ESP boards but I have not t...
by dhallgb
Sun Oct 09, 2016 10:44 am
Forum: WiPy and CC3200 boards
Topic: Extra character on UART
Replies: 3
Views: 4847

Extra character on UART

I'm using the WiPy 1.0 with the Waveshare e-ink display. That display needs a specific command string over UART. In attempting to send that string format I seem to get extraneous characters inserted in the string. To test, I set up a loopback connecting pins 12 and 13 with a small code fragment: [co...