Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,242 Programmers. There are 2,267 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Help

 
Reply to this topicStart new topic

Help, kindly assist me

dwun
post 4 May, 2008 - 10:43 AM
Post #1


New D.I.C Head

*
Joined: 5 Mar, 2008
Posts: 2



Hi
i'm on IT at a small firm and need to automate a process...i've been learning python for some time now and would need help on the ffg problem:

the program needs to communicate with a modem over the serial port,sending commands like "read message" and other AT commands ""at specific time intervals of the day"" and continue to listen in on the modem for any incoming message. the message recieved is then stored in a text file on my computer.

so far i've comeup with a script similar to this::

CODE

import serial
from time import *


def conSerial(port=1): #this selects the COM port                           #andcontrols data over serial
def ...e.t.c

the main problems i'm having now are:
how do i keep the program running without using a while loop as i realise doing something like
CODE

def wait(s=0):
endtime=time()+s
while (endtime>time()):
     pass

...will make my system stuck for the time specified
Also, is there no way to use an instance of 'serial.Serial' defined in function 1,in function 2 without declaring it 'global'?

In general,i think i'm still a newbie...Help will be appreciated
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Nova Dragoon
post 5 May, 2008 - 01:20 PM
Post #2


The Innocent Shall Suffer, Big Time

Group Icon
Joined: 16 Aug, 2001
Posts: 5,754

use signals or threads to keep your program from being locked into the while loop with nothing else to do.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 08:19AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month