Python Forum
Setting GPIO on Raspberry PI using a function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting GPIO on Raspberry PI using a function
#5
Quote: none of my GPIO are being set, if I use print (MUX1shift1_Y0) I get the print out of <function <lambda> at 0x73a53810>:

Those are functions.  They don't do anything, unless you call them.  ie: MUX1shift1_Y0 does nothing (like, literal nothing), while MUX1shift1_Y0() will call the function.

Quote:Also at the risk of opening a can of worms can anyone explain lambda to me and why I was told to stay away from it?
They're just anonymous functions.  Whoever told you to stay away from them probably said so because they can be confusing to newbies.  In python, they're a little underpowered compared to most languages which have them, but for this case, they're perfectly capable.
Reply


Messages In This Thread
RE: Setting GPIO on Raspberry PI using a function - by nilamo - Dec-29-2017, 08:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  function return boolean based on GPIO pin reading caslor 2 1,307 Feb-04-2023, 12:30 PM
Last Post: caslor
  class Update input (Gpio pin raspberry pi) caslor 2 880 Jan-30-2023, 08:05 PM
Last Post: caslor
  Webhook, post_data, GPIO partial changes DigitalID 2 1,096 Nov-10-2022, 09:50 PM
Last Post: deanhystad
  try function working on PC but not raspberry pi AnotherSam 1 1,615 Oct-11-2021, 04:51 AM
Last Post: bowlofred
  Seemingly unstable GPIO output while executing from RetroPie LouF 6 4,073 Feb-19-2021, 06:29 AM
Last Post: LouF
  Picture changing triggered by GPIO q_nerk 2 2,684 Dec-14-2020, 03:32 PM
Last Post: DeaD_EyE
  GPIO high if network IP has good ping duckredbeard 3 2,423 Oct-12-2020, 10:41 PM
Last Post: bowlofred
  raspberry pi tank gpio help jatgm1 1 2,482 May-06-2020, 09:00 PM
Last Post: Larz60+
  Where should I place GPIO.cleanup() shallanq 2 2,253 Apr-11-2020, 05:02 AM
Last Post: shallanq
  Orange PI Win steering LEDs connect to GPIO djmcg 0 1,577 Dec-27-2019, 08:26 AM
Last Post: djmcg

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020