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

Join 117,608 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,444 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



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


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


The Innocent Shall Suffer, Big Time

Group Icon
Joined: 16 Aug, 2001
Posts: 6,009



Thanked 2 times

Dream Kudos: 515

Expert In: Python, Linux

My Contributions


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

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 11:35PM

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