Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #69908
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <grawburg@myglnc.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | UNSURE 0.321 |
| X-Spam-Level | *** |
| X-Spam-Evidence | '*H*': 0.37; '*S*': 0.01; 'def': 0.12; 'pressed': 0.16; '\xc2\xa0i': 0.16; '\xc2\xa0if': 0.16; 'variable': 0.18; "i've": 0.25; 'gets': 0.27; 'function': 0.29; "i'm": 0.30; 'code': 0.31; 'probably': 0.32; 'brian': 0.33; 'received:66': 0.35; "can't": 0.35; 'wrong': 0.37; 'project': 0.37; 'button': 0.38; '8bit%:4': 0.38; 'ends': 0.38; 'to:addr:python-list': 0.38; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'subject:"': 0.60; 'free': 0.61; 'entire': 0.61; 'first': 0.61; 'you.': 0.62; 'term': 0.63; 'become': 0.64; 'north': 0.65; 'periodically': 0.68; 'plc': 0.78; 'truth': 0.81; 'books.': 0.84; 'received:192.168.55': 0.84 |
| X-ASG-Debug-ID | 1396987765-067885457a18cbb0001-tYLEC7 |
| X-Barracuda-Envelope-From | grawburg@myglnc.com |
| Date | Tue, 08 Apr 2014 16:09:28 -0400 |
| X-Barracuda-Apparent-Source-IP | 216.152.2.119 |
| To | python-list@python.org |
| From | Grawburg <grawburg@myglnc.com> |
| Subject | "Latching" variables in function |
| X-ASG-Orig-Subj | "Latching" variables in function |
| X-Mailer | IceWarp Mailer 10.3.1 |
| X-Priority | 3 |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | quoted-printable |
| Content-Type | text/plain; charset=UTF-8 |
| X-Barracuda-Connect | UNKNOWN[192.168.55.60] |
| X-Barracuda-Start-Time | 1396987765 |
| X-Barracuda-URL | http://192.168.55.85:8000/cgi-mod/mark.cgi |
| X-Barracuda-Spam-Score | 0.00 |
| X-Barracuda-Spam-Status | No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.4 tests= |
| X-Barracuda-Spam-Report | Code version 3.2, rules version 3.2.3.4697 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- |
| X-Mailman-Approved-At | Wed, 09 Apr 2014 01:48:40 +0200 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9045.1397000922.18130.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1397000922 news.xs4all.nl 2941 [2001:888:2000:d::a6]:39336 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:69908 |
Show key headers only | View raw
I've probably used the wrong term - I'm thinking of what I do when writing PLC code - so I can't find how to do this in my reference books. This is part of a project I'm working on with a Raspberry Pi and an MCP23017 port expander. I have a N/O pushbutton that I want to "latch" a value to a variable when it's been pressed. I have this function that gets called periodically in a 'while True' statement: def button(): pushbutton = 0 button_value = 0 pushbutton=bus.read_byte_data(address,GPIOB) if pushbutton > 0: button_value = 1 return button_value I need button_value to become '1' when the button is pressed and to remain '1' until the entire program (only about 25 lines) ends with a sys.exit() What do I use to 'latch' button_value? Brian Grawburg North Carolina -- The truth will set you free . . .but first it will infuriate you.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
"Latching" variables in function Grawburg <grawburg@myglnc.com> - 2014-04-08 16:09 -0400
Re: "Latching" variables in function Denis McMahon <denismfmcmahon@gmail.com> - 2014-04-09 00:28 +0000
Re: "Latching" variables in function Mark H Harris <harrismh777@gmail.com> - 2014-04-09 08:53 -0500
Re: "Latching" variables in function alister <alister.nospam.ware@ntlworld.com> - 2014-04-09 15:43 +0000
csiph-web