Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 5th, 2013, 11:15 AM
Tman21901 Tman21901 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 2 Tman21901 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 56 sec
Reputation Power: 0
Question Multiple Scripts or Functions at Once

I am fairly new to coding, and am much better modifying others code to work for my own applications than to write my own from scratch.

I currently have been experimenting with the Raspberry Pi, specifically its control of the GPIO pins.

I have several python scripts that control different components (ex. temp sensor, light sensor, relays, push button). Each component is controlled by a separate script, and the relay one is controllable though a web interface.

What is a suitable (and efficient) method to consolidate all the scripts into one? Should I have each as a separate function, all in one large function? Something completely different?

Any help would be greatly appreciated. Thanks.

Reply With Quote
  #2  
Old March 6th, 2013, 09:43 AM
rrashkin's Avatar
rrashkin rrashkin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Location: 39N 104.28W
Posts: 97 rrashkin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 15 h 26 m
Reputation Power: 2
I think the most "pythonic" way would be to have a master script that imports the various worker-bee scripts, as modules, and executes them in the order or upon events as appropriate.

Reply With Quote
  #3  
Old March 11th, 2013, 01:15 PM
Tman21901 Tman21901 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 2 Tman21901 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 56 sec
Reputation Power: 0
Thanks for the advice, I'll see what I can come up with!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Multiple Scripts or Funcitons at Once

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap