Go to advanced search

by duckredbeard
Fri Sep 11, 2020 11:26 am
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

I intend to fully test his process as well. My next step is to pass on the "percent" variable to my phone using the Android apps Tasker and AutoRemote messaging. Tasker will then extract the variable from that message and populate a widget on my phone showing the quantity. It already shows the tempe...
by duckredbeard
Thu Sep 10, 2020 6:28 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

Scotty is the winner. After commenting out line 94 it started working. You guys are awesome for jumping in the middle of my hobbled together and botched code and making it work. I also had to bump my "if 100 >= percent >= ..." lines to "if 101 >= percent >= 40" because it would waver between 99.8 an...
by duckredbeard
Thu Sep 10, 2020 5:47 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

This is a value you should never change in your while loop. Specify it at the start of the program and never change it. I would like to have a moment in the program where the scale provides that amount and it doesn't change. This is what I was expecting to happen with the button push. I'm thinking ...
by duckredbeard
Thu Sep 10, 2020 5:27 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

bensimmo wrote:
Thu Sep 10, 2020 2:53 pm

altered 'reset'
I had to remove the indent on line 22. No big deal there. Just can't get past line 114 where I get "TypeError: get_scale() takes 1 positional argument but 2 were given". I had an "unbalanced parentheses" issue and edited it to be "led_scale( get_scale(full_keg, scale))"
by duckredbeard
Thu Sep 10, 2020 2:50 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

This is a value you should never change in your while loop. Specify it at the start of the program and never change it. I would like to have a moment in the program where the scale provides that amount and it doesn't change. This is what I was expecting to happen with the button push. I'm thinking ...
by duckredbeard
Thu Sep 10, 2020 2:00 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

This is a value you should never change in your while loop. Specify it at the start of the program and never change it. I would like to have a moment in the program where the scale provides that amount and it doesn't change. This is what I was expecting to happen with the button push. I'm thinking ...
by duckredbeard
Thu Sep 10, 2020 1:53 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

Once you assign a variable KegFull = 100 then as long as you don't change it, it will always be 100 This allowsy you to alter that constant (sometime in python they like to write KEGFULL = 100, in all caps so you no never to change it in the program itself) it means if you fit a larger keg, you jus...
by duckredbeard
Thu Sep 10, 2020 1:34 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Re: Calculating the percent of a number that changes

Why are you changing the value of "full" each time to the value of "keg"? Shouldn't full be a constant? (Line 85) Yes, I agree. But how do I establish it as a constant value? It seems that no matter where I move line 85 to, it either errors out on not being defined or the issue persists. I expect i...
by duckredbeard
Thu Sep 10, 2020 1:13 pm
Forum: Python
Topic: Calculating the percent of a number that changes
Replies: 16
Views: 382

Calculating the percent of a number that changes

The goal of lines 85 through 90 are to get the percent remaining of a variable that is established when a button is pressed. When weight is removed from "keg1" the variable "percent" should be recalculated. When I run this, everything runs as expected with the exception of the "percent" variable nev...
by duckredbeard
Sun Sep 06, 2020 12:54 pm
Forum: Beginners
Topic: Not getting display from Raspberry PI 4
Replies: 4
Views: 131

Re: Not getting display from Raspberry PI 4

Try using a tv with an HDMI input to do this one time, after that there should be no problem.

I believe there is a file you can edit in the sd card, not sure what and where though.
by duckredbeard
Sun Sep 06, 2020 12:50 pm
Forum: Beginners
Topic: Not getting display from Raspberry PI 4
Replies: 4
Views: 131

Re: Not getting display from Raspberry PI 4

Your Pi4 needs to know what resolution it should be displaying. Without a monitor connected it will not boot unless you specify what resolution to display. This might help: https://pimylifeup.com/raspberry-pi-screen-resolution/#:~:text=It%20is%20also%20possible%20to,t%20have%20easy%20terminal%20acce...
by duckredbeard
Fri Sep 04, 2020 4:16 pm
Forum: Python
Topic: A Quick DHT22 Query
Replies: 8
Views: 280

Re: A Quick DHT22 Query

Like this assuming you want the printed values logged to a txt file and not a csv file. untested code expect errors Awesome. Thanks. Except now I want to have all of this logging compiled in a Google Sheet. When will this tinkering ever end? I should have just been happy with the LEDs and overtemp ...
by duckredbeard
Fri Sep 04, 2020 1:44 pm
Forum: Python
Topic: A Quick DHT22 Query
Replies: 8
Views: 280

Re: A Quick DHT22 Query

I also just started a DHT22 project. Since it is running on a crontab @reboot on a headless unit. Other than getting a notification push when it starts, I have no confirmation that it is still running. It enables LEDs to indicate the temperature (good or bad), but I can't see the values. Where would...
by duckredbeard
Fri Sep 04, 2020 1:02 pm
Forum: Python
Topic: How do you add a cooldown step to this?
Replies: 1
Views: 120

How do you add a cooldown step to this?

My freezer temp monitor has a function where it sends me a message (using requests.post and Android apps Tasker and Join) when the looping temperature check detects a high temperature. In this program, these are the "FreezerF" and "KegF" variables. My problem is that since it is looping, it will sen...
by duckredbeard
Tue Sep 01, 2020 10:35 pm
Forum: Python
Topic: Bulk dimming of all my LEDs in this project.
Replies: 1
Views: 75

Re: Bulk dimming of all my LEDs in this project.

Perhaps if I made them all PWMLEDs and added a dimmer value after that. This might compare to the documentation on gpiozero's site... #Define LED indicators - these are GPIO numbers LED1 = PWMLED(21) #Blue LED2 = PWMLED(26) #Red LED3 = PWMLED(20) #Amber LED4 = PWMLED(19) #Green LED5 = PWMLED(16) #Gr...
by duckredbeard
Tue Sep 01, 2020 10:16 pm
Forum: Python
Topic: Bulk dimming of all my LEDs in this project.
Replies: 1
Views: 75

Bulk dimming of all my LEDs in this project.

My keg scale uses 5mm LEDs that turned out to be too bright for where they are installed. I am using gpiozero, and I know there is a PWMLED option to make them dimmer. Is there a way to assign the dimmed value to all LEDs in one line of code, so that whenever they are commanded on with LED.on() that...
by duckredbeard
Sat Aug 29, 2020 9:30 pm
Forum: Beginners
Topic: Using crontab schedule a script that loops
Replies: 19
Views: 599

Re: Using crontab schedule a script that loops

Won’t a simple @reboot in crontab work? e.g. @reboot python3 -u /home/pi/scripts/neo.py >> /home/pi/scripts/neo.log 2>&1 I have found that to be unreliable. Adding to etc/rc.local has also been unreliable. Running from systemd is generally the best way to handle a script that needs to start at rebo...
by duckredbeard
Sat Aug 29, 2020 4:37 pm
Forum: Python
Topic: HX711 not setting reading format
Replies: 4
Views: 144

Re: HX711 not setting reading format

I moved this program to the folder that holds the functioning program and this fixed it - missing library was the issue after all.
by duckredbeard
Sat Aug 29, 2020 1:36 pm
Forum: Beginners
Topic: Using crontab schedule a script that loops
Replies: 19
Views: 599

Re: Using crontab schedule a script that loops

neilgl wrote:
Sat Aug 29, 2020 12:53 pm
Won’t a simple @reboot in crontab work? e.g.

Code: Select all

@reboot python3 -u /home/pi/scripts/neo.py >> /home/pi/scripts/neo.log 2>&1
I have found that to be unreliable. Adding to etc/rc.local has also been unreliable.
by duckredbeard
Sat Aug 29, 2020 12:36 pm
Forum: Beginners
Topic: Using crontab schedule a script that loops
Replies: 19
Views: 599

Re: Using crontab schedule a script that loops

I've had issues where a power outage or forced reboot requires me to manually restart the program. Since the pi is in my garage ceiling and without a monitor, I use TeamViewer to interface remotely. Sure I could use other methods (VNC, SSH), I just haven't gotten around to exploring those options. T...
by duckredbeard
Sat Aug 29, 2020 12:33 pm
Forum: Beginners
Topic: Using crontab schedule a script that loops
Replies: 19
Views: 599

Re: Using crontab schedule a script that loops

I've had issues where a power outage or forced reboot requires me to manually restart the program. Since the pi is in my garage ceiling and without a monitor, I use TeamViewer to interface remotely. Sure I could use other methods (VNC, SSH), I just haven't gotten around to exploring those options. T...
by duckredbeard
Fri Aug 28, 2020 4:54 pm
Forum: Python
Topic: HX711 not setting reading format
Replies: 4
Views: 144

Re: HX711 not setting reading format

Strange that it works on another program that was the parent of this one. I simply added more LEDs and changed the values that would trigger them. Perhaps I need to start from scratch. Maybe there is some kind of whitespace that is causing this.
by duckredbeard
Fri Aug 28, 2020 3:16 pm
Forum: Python
Topic: HX711 not setting reading format
Replies: 4
Views: 144

HX711 not setting reading format

I am getting the following error when running my code. I have a functioning version of this script, but this one is edited to include more LEDs and different values for triggering the LEDs. On this version, I am erroring on line 50 (which is hx.set_reading_format("MSB", "MSB"))with this: attributeer...
by duckredbeard
Thu Aug 27, 2020 6:30 pm
Forum: Beginners
Topic: Using crontab schedule a script that loops
Replies: 19
Views: 599

Using crontab schedule a script that loops

I have a home security system that monitors a few doors and a motion sensor. Instead of having it start on boot (which I've not figured out), I'd like to have it start on crontab. Perhaps starting it every hour as a safeguard would be good. Since this script loops, would crontab start a duplicate of...
by duckredbeard
Mon Aug 17, 2020 12:57 pm
Forum: General discussion
Topic: Passing variables to Tasker and Join (Android apps)
Replies: 1
Views: 84

Passing variables to Tasker and Join (Android apps)

I am a heavy user of the Android apps Tasker and Join. They are the communication link from my Home Security Pi system to my Android and PC devices. I currently use requests.post to prebuilt URLs that trigger events on my phone, creating notifications and other alerting scenarios. I would like to cl...

Go to advanced search