Go to advanced search

by Dangermoth
Mon Nov 18, 2019 1:34 pm
Forum: Python
Topic: API request crashes if no internet
Replies: 2
Views: 156

Re: API request crashes if no internet

Thanks, that gives me a direction to pursue, I will investigate some sort of try-except routine, I've done this in the past with simple serial reading, not quite sure where to start with this one though.
by Dangermoth
Mon Nov 18, 2019 11:44 am
Forum: Python
Topic: API request crashes if no internet
Replies: 2
Views: 156

API request crashes if no internet

Morning all, I have a realy cool weather station running based on a Raspberry Pi and 7 inch touch screen, this programmed in Python 2 and displayed via Pygame. Details including code here: https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=255791&p=1560189#p1560189 It works an absolute treat ho...
by Dangermoth
Fri Nov 01, 2019 4:52 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

Wow that appears to be working, is it because I needed to set the variables to -1000 and 1000? I can't see any other difference from what I've tried. I need to wait for the temperature to change to see if the values are being stored, Will give you an update on Monday. Thank you so much for your help
by Dangermoth
Fri Nov 01, 2019 4:13 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

Currently working code but without min and max temp import forecastio import requests import pygame import math from pygame.locals import* pygame.init() pygame.font.init() #gameDisplay=pygame.display.set_mode ((795,445)) gameDisplay=pygame.display.set_mode ((800,450)) pygame.display.set_caption("Pau...
by Dangermoth
Fri Nov 01, 2019 3:45 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

As per this? import forecastio import requests import pygame import math from pygame.locals import* pygame.init() pygame.font.init() gameDisplay=pygame.display.set_mode ((800,450)) pygame.display.set_caption("Paulas new weather station") clock = pygame.time.Clock() darkblue = (0,0,200) blue = (0,255...
by Dangermoth
Fri Nov 01, 2019 3:30 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

This is what I'm struggling with, what ever I set them to within the function will get set to that value every time the code loops, I have never managed to sucsessfully define a global value outside of a function as one can easily do in C. In this case python insists that I have not assigned the var...
by Dangermoth
Fri Nov 01, 2019 3:11 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

I put bold tags around the bit of code I added so it would stand out in the post, its not actually part of my code. There is no code that access the variables outside of this function. I cut the code a bit short when I posed it so I missed the bit that's sets the min and max; def forcast(): api_key ...
by Dangermoth
Fri Nov 01, 2019 2:37 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

def forcast(): api_key = "-----------------------------f" lat = 53.38 #lattidue lng = -1.22 #longditue forecast = forecastio.load_forecast(api_key,lat,lng) # send request current = forecast.currently() minutely = forecast.minutely() daily = forecast.daily() [b]global temp_max,temp_min[/b] pygame.dr...
by Dangermoth
Fri Nov 01, 2019 2:13 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

Or to put it another way, how do I declare a global value within a function?

If I type' temp_max = 0' within the function this doesn't give a traceback error but the value is set to 0 every time the code loops.
by Dangermoth
Fri Nov 01, 2019 2:09 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Re: Python weather station storing min and max values

Do I need to assign a value to the variable i.e 'temp_max = 0' if I declare the variable within the function?
by Dangermoth
Fri Nov 01, 2019 1:49 pm
Forum: Python
Topic: Python weather station storing min and max values
Replies: 18
Views: 856

Python weather station storing min and max values

Afternoon chaps, a really basic question here. api weather station small.png I'm building a really cool weather station around a Raspberry Pi and getting data from Darksky by sending out an api call every 5 minutes and displaying the results using pygame. This is working really well however I would ...
by Dangermoth
Mon Dec 17, 2018 7:55 pm
Forum: Troubleshooting
Topic: [solved] touch very inaccurate under rc.local
Replies: 6
Views: 484

Re: [solved] touch very inaccurate under rc.local

Hey guys, the autostart thing works a treat, mouse calibration now spot on, many thanks for you help. :P
by Dangermoth
Fri Dec 14, 2018 7:29 pm
Forum: Troubleshooting
Topic: [solved] touch very inaccurate under rc.local
Replies: 6
Views: 484

Re: touch very inaccurate under rc.local

OK, I'm going to try autostart, this looks very intimidating and is way deeper than I want to get into linux, in my experience typing cryptic commands into the text editor always ends badly, before I take the plunge how do I get the text editor back up when the pi fails to boot? I'm more than happy ...
by Dangermoth
Fri Dec 14, 2018 2:16 pm
Forum: Troubleshooting
Topic: [solved] touch very inaccurate under rc.local
Replies: 6
Views: 484

Re: touch very inaccurate under rc.local

Ok thanks, that makes perfect sense now about rc.local, I have found a tutorial for systemd which sounds a lot more promising so I will try that. Adding 'disable_splash=1' doesn't appear to make any difference, I may have read somewhere that if using NOOBS the system boots twice I wonder if that mig...
by Dangermoth
Fri Dec 14, 2018 10:35 am
Forum: Troubleshooting
Topic: [solved] touch very inaccurate under rc.local
Replies: 6
Views: 484

Re: touch very inaccurate under rc.local

Thanks I appreciate your reply. I used 'sudo' because I used this example that used it; https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/ When I start it normally I right click on the file icon and open with python2, or when I said I open it via rc.local manually ...
by Dangermoth
Fri Dec 14, 2018 8:17 am
Forum: Troubleshooting
Topic: [solved] touch very inaccurate under rc.local
Replies: 6
Views: 484

[solved] touch very inaccurate under rc.local

Hey all, apologies if this is a dumb question I've searched but struggled to find an answer. I did originally post this in the python section but I think it might be better off here. I'm building a screen for my truck to give speed, gps, fuel consumption ect. I can boot into the python / pygame appl...
by Dangermoth
Thu Dec 13, 2018 7:47 pm
Forum: Python
Topic: Touch screen mouse random under rc.local
Replies: 0
Views: 169

Touch screen mouse random under rc.local

Hey all, apologies if this is a dumb question I've searched but struggled to find an answer. I'm building a screen for my truck to give speed, gps, fuel consumption ect. I can boot into the python / pygame application and in theory shutdown via an on screen button press, my issue is that if I boot i...
by Dangermoth
Wed Dec 12, 2018 10:24 am
Forum: Beginners
Topic: (solved) python forecastio / darksky displaying current data
Replies: 5
Views: 983

Re: (solved) python forecastio / darksky displaying current data

neilgl that's perfect, works a treat thankyou so much :P I tried all permutations of print but couldn't get anything to work, sometimes you can spend days fruitlessly trawling through the Internet trying to find something basic in fear of being flamed, then just give up and ask then have the answer ...
by Dangermoth
Sat Dec 08, 2018 12:05 pm
Forum: Beginners
Topic: (solved) python forecastio / darksky displaying current data
Replies: 5
Views: 983

Re: python forecastio / darksky displaying current data

Yes this is the 1000 free api calls per day, I'm so glad other people know of the system. This is my weather station, I'm pretty pleased with it especially as its my very first use of both a pi and python! weather small.JPG My issue is that my company is moving premises soon to a building not dissim...
by Dangermoth
Fri Dec 07, 2018 5:05 pm
Forum: Python
Topic: cant get mouse co-ordinates within function loop
Replies: 0
Views: 321

cant get mouse co-ordinates within function loop

Hey guys, pretty basic issue here I'm sure you can help with. I'm writing a bit of python code that will display one of several graphical pages on pygame. I've done this a few times using a single page and it works really well. I now want to expand so I have several pages that can display different ...
by Dangermoth
Fri Dec 07, 2018 2:57 pm
Forum: Beginners
Topic: (solved) python forecastio / darksky displaying current data
Replies: 5
Views: 983

(solved) python forecastio / darksky displaying current data

Afternoon all, I am currently building an internet based weather staiton to display the current weather information i.e. temperature, humidity ect. using the Darksky api and python forsastio. The problem is that I can print the current weather summary and current text that I can use to display an ap...
by Dangermoth
Fri Nov 23, 2018 7:24 pm
Forum: Beginners
Topic: returning values from functions
Replies: 6
Views: 602

Re: returning values from functions

Thanks for the quick reply guys, I just now found adding 'global result' after the 4th line seems to work as well, I guess this is how I make the variable a global although I believe thats frowned upon in python. I did try python 3 but had too many issues, the main one being that rpi_backlight refus...
by Dangermoth
Fri Nov 23, 2018 7:07 pm
Forum: Beginners
Topic: returning values from functions
Replies: 6
Views: 602

returning values from functions

Afternoon all, OK, flame suit on, I sure someone can help with this one. I've written quite a few PRI programs such as graphical Pygame weather stations that have been running a treat for many months but I've always been limited as I have never been able to return any sort of returned value from a f...
by Dangermoth
Tue Jul 24, 2018 2:30 pm
Forum: Beginners
Topic: rpi_backlight no module found
Replies: 4
Views: 666

Re: rpi_backlight no module found

Aha, I don't seem to have Python 2 installed, slightly annoying as I've always used python 2 for all projects up to now on other pi's. I'm sure python 2 must be installed somewhere but does not show up under the 'programming' drop down menu, any idea's were it might be hiding? if I type dpkg --get-s...
by Dangermoth
Tue Jul 24, 2018 2:15 pm
Forum: Beginners
Topic: rpi_backlight no module found
Replies: 4
Views: 666

Re: rpi_backlight no module found

If I type;

dpkg --get-selection

Should rpi_backlight show up in the list??

BTW I'm running Raspian stretch.

Go to advanced search