Go to advanced search

by racpi
Wed Jun 28, 2017 8:21 am
Forum: Python
Topic: Conversion float to byte and backward
Replies: 14
Views: 9648

Re: Conversion float to byte and backward

to simplify it a bit . the "ieeef" structure is unnecessary , its a legacy from other experiments a simple union class can be added class myunion(Union): _fields_ = [("real", c_float), ("hdata",c_ubyte *4 )] and used like this tp=myunion() tp.real=50.0 print "as ieee",barray2str(tp.hdata) print "as ...
by racpi
Tue Jun 27, 2017 12:43 pm
Forum: Python
Topic: Conversion float to byte and backward
Replies: 14
Views: 9648

Re: Conversion float to byte and backward

just fooling around with ctypes and structures from ctypes import * import array import struct import binascii class ieeef(Structure): _fields_ = [ ("fdata",c_float)] class calf(Union): _fields_ = [("data", ieeef), ("hdata",c_ubyte *4 )] def str2barray(S): try: return bytearray.fromhex(S) except Val...
by racpi
Mon May 29, 2017 8:36 am
Forum: Python
Topic: Strucs
Replies: 4
Views: 904

Re: Strucs

by racpi
Mon Aug 22, 2016 11:25 am
Forum: Python
Topic: Reading wrong data from slave through serial
Replies: 5
Views: 1808

Re: Reading wrong data from slave through serial

this works for me it looks to me like you are not making sure the serial buffer has anything in it when read (assuming serial timeout is active) . and you are not clearing readBuffer between button presses def btn_callback(): print ("Command LED ON") ser.write(ON) ser.flushInput() #readBuffer=[] alt...
by racpi
Sun May 08, 2016 1:10 am
Forum: Python
Topic: structure/union
Replies: 4
Views: 1486

Re: structure/union

the finished product to transfer weather station packet data to/from a byte array. from ctypes import * class wh(BigEndianStructure): _fields_ = [("id", c_uint64,12), ("temp", c_uint64, 12), ("rh", c_uint64, 8), ("wind", c_uint64, 8), ("gust", c_uint64, 8), ("rain", c_uint64, 16), ("bat", c_ubyte,4)...
by racpi
Thu May 05, 2016 10:01 pm
Forum: Python
Topic: structure/union
Replies: 4
Views: 1486

Re: structure/union

thanks paddy the structure pack/unpack will cover most of it . for the weather station data I have this so far just need to fit in the 9th byte nicely and maybe reverse endianness from ctypes import * class wh(Structure): _fields_ = [("rain", c_uint64, 16), ("gust", c_uint64, 8), ("wind", c_uint64, ...
by racpi
Thu May 05, 2016 5:38 am
Forum: Python
Topic: structure/union
Replies: 4
Views: 1486

structure/union

i have a rfm12b/rfm69 packet radio system that has a r-pie master and various pic/atmega slaves . packet radio structure [to,from,payload_length,payload {1-61 bytes},crc.low,crc.high](all bytes) some payloads payload - weather station [ident-12bits,temperature-12bits,rh-byte,wind-byte,gust-byte,rain...
by racpi
Thu Apr 07, 2016 1:35 am
Forum: Python
Topic: RPi, Sqlite Database, Python Q
Replies: 5
Views: 1324

Re: RPi, Sqlite Database, Python Q

if you live in a country with daylight saving its worth making the time field UTC time ,it saves complexity over wether is DST on/off
by racpi
Fri Mar 25, 2016 1:04 am
Forum: General discussion
Topic: pi 3 wifi range
Replies: 34
Views: 70958

Re: pi 3 wifi range

sudo rpi-update
DougieLawson's suggestion has worked for me , range is better and connection reliability much improved. thanks
by racpi
Mon Mar 07, 2016 10:34 am
Forum: General discussion
Topic: pi 3 wifi range
Replies: 34
Views: 70958

pi 3 wifi range

I fired up my new pi 3 today , very disappointed in wifi range . it starts to get patchy at 10m and drops out completely shortly there after. every other wifi gadget I have including pi's with a wifi dongle can double or triple that range at least .
its not what I expected :(
by racpi
Tue Dec 22, 2015 6:14 am
Forum: General discussion
Topic: Quote for a (simple?) communication system.
Replies: 19
Views: 2641

Re: Quote for a (simple?) communication system.

you could not find anything as simple as this useful ?
http://www.esp8266basic.com/
by racpi
Sun Dec 06, 2015 2:05 am
Forum: Python
Topic: how to get tkinter label's text update along with GPIO i/ps
Replies: 2
Views: 1008

Re: how to get tkinter label's text update along with GPIO i

you could try it like this from tkinter import * import RPi.GPIO as pi import tkinter.simpledialog pi.setwarnings(False) Test_pins=[14,15,18,23,24,25,8,7] Status=[] class App(Frame): def __init__(self,parent=None,**kw): Frame.__init__(self,parent,**kw) self.parent = parent pi.setmode(pi.BCM) self.St...
by racpi
Wed Nov 25, 2015 2:19 am
Forum: Python
Topic: Scrolling graph using tkinter
Replies: 7
Views: 2986

Re: Scrolling graph using tkinter

hi roger just got around to using your code for a scrolling barometer display , works great. did you get anywhere with legends/axis info, ticks etc ? from sys import version_info if version_info[0] < 3: import Tkinter as tk else: import tkinter as tk import os import datetime import sqlite3 import g...
by racpi
Wed Jul 29, 2015 10:37 pm
Forum: General discussion
Topic: usb oscilloscope
Replies: 8
Views: 4370

Re: usb oscilloscope

if its mainly digital signals you are looking at then a saleae logic data analyser is hard to go past . there are cheap clones of the logic8 around but they have issues (crosstalk between channels is woeful) .the genuine product is best and similar in price to the hantek usb scope
by racpi
Sat Jul 25, 2015 1:03 pm
Forum: Python
Topic: Scrolling graph using tkinter
Replies: 7
Views: 2986

Re: Scrolling graph using tkinter

thanks for sharing this ,it was the next thing to do on my pi learning curve .
works just fine python 2.7 on win7 machine too
by racpi
Tue Mar 24, 2015 11:55 am
Forum: Python
Topic: pigpio callback
Replies: 4
Views: 4114

Re: pigpio callback

thanks for the reply ,but it was in fact the first place I looked . I see nothing there to pause,cancel,stop or even remove a callback once initiated . unlike notify but notify has no edge control .
by racpi
Tue Mar 24, 2015 12:21 am
Forum: Python
Topic: pigpio callback
Replies: 4
Views: 4114

pigpio callback

I'm writing a python pgm to use a rfm12b or a rfm69cw module,I'm thinking I can use a callback from the rfm12b int output to trigger spi read or xfer , I'm pretty sure this is doable for rx. (especially using a rfm69 with its bigger buffer) problem I envision is that rfm modules also generate interr...
by racpi
Sat Feb 28, 2015 5:34 am
Forum: HATs and other add-ons
Topic: reset_on / off no longer work
Replies: 6
Views: 5769

Re: reset_on / off no longer work

thanks for that , problem resolved by disabling device tree
by racpi
Wed Feb 25, 2015 8:57 am
Forum: HATs and other add-ons
Topic: reset_on / off no longer work
Replies: 6
Views: 5769

reset_on / off no longer work

just updated and upgraded my raspian to the latest version and now gerts reset_on an reset_off scripts no longer function. in fact the reset jumper needs to be removed before the gertduino 328 will operate. I assume this will make uploading sketches difficult too. any tips on how to remedy this woul...
by racpi
Fri Jul 25, 2014 10:58 am
Forum: Python
Topic: how to get a serial event to update a tkinter screen
Replies: 6
Views: 6081

Re: how to get a serial event to update a tkinter screen

thanks everyone for your replies. I still don't understand the tk loop yet , when I try and insert a looping function in the tk loop it all goes wrong if I insert this into my app class I get syntax errors (self has no function after I think) def checkSerial(self): # check the serial for data and do...
by racpi
Tue Jul 22, 2014 8:10 am
Forum: Python
Topic: how to get a serial event to update a tkinter screen
Replies: 6
Views: 6081

how to get a serial event to update a tkinter screen

I'm trying to make a gui interface that can monitor,log and interact with some wireless arduino devices (a solar panel tracker and a pid controlled wood heater) . I ultimately want to run it on the pi but I offer this example code that I'm running on a pc for ease of experimention. what I would like...
by racpi
Tue May 06, 2014 11:25 pm
Forum: HATs and other add-ons
Topic: Arduino IDE
Replies: 4
Views: 2630

Re: Arduino IDE

try taking the "-master" off the end of the library name
by racpi
Thu Apr 10, 2014 10:58 pm
Forum: HATs and other add-ons
Topic: Connecting to Gertduino via serial
Replies: 20
Views: 14781

Re: Connecting to Gertduino via serial

don't forget the pi holds the gertduino reset low until you run gerts reset_off script or remove the reset jumper.
by racpi
Wed Apr 09, 2014 9:40 am
Forum: Python
Topic: Raspberry Pi and Arduino Storing Data
Replies: 2
Views: 1034

Re: Raspberry Pi and Arduino Storing Data

have a look at sqlite3
by racpi
Tue Mar 11, 2014 7:48 am
Forum: HATs and other add-ons
Topic: AVRDUDE complains
Replies: 12
Views: 5241

Re: AVRDUDE complains

definitely my experience finds that the spi pin signals when programing are so marginal that any load at all (maybe even casting a dark shadow) can cause the fuses to be misconfigured, if you have a programmer its no big deal just a real nuisance . I find I have to shut the pi down ,remove the spi l...

Go to advanced search