By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

problem i am experiencing with Python "send" command.

P: 9
I am having issues with the Python "send" command.
For example, I am running the next code which is checking ADC.
The code is right, there are no errors. I tried to run on other computer and it was fine.

The script does a loop with the following operations:
measures the ADC value at the ADC_IN1 pin, by issuing AT#ADC and AT#ADC=1,2,
then using GPIO.getADC, then prints the result on the debug port, sleeps for
0,5 sec
(the permitted Vmax of the input is 2V)
Expand|Select|Wrap|Line Numbers
  1. import MDM
  2. import MOD
  3. import GPIO
  5. MDM.send("AT#ADC\r", 5)
  6. a = MDM.receive(20)
  7. print "AT#ADC:%s\r" % a
  9. print 'sleep 0,5 seconds\r'
  10. MOD.sleep(5)
  12. trial = 0
  13. while (1 == 1):
  14.     trial = trial + 1
  15.     print 'loop %d:\r' % trial
  17.     MDM.send("AT#ADC=1,2\r", 5)
  18.     a = MDM.receive(20)
  19.     print "\tAT#ADC=1,2 --> %s\r" % a
  21.     mv = GPIO.getADC(1)
  22.     print "GPIO.getADC(1) --> %d mV\r" % mv
  24.     print 'sleep 0,2 seconds\r'
  25.     MOD.sleep(2)

The error I get :

Traceback (innermost last):
File "C:\Program Files\Python\Pythonwin\pywin\framework\scriptutils .py", line 301, in RunScript
exec codeObject in __main__.__dict__
File "C:\Program Files\Python\Examples\", line 39, in ?
MDM.send("AT#ADC\r", 5)
AttributeError: send

I have to say that all of the codes that i tried to run with the "send" command, i always get this error!
May 20 '10 #1
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 626
This is not a Python error, but an MDM error. It appears that MDM does not have a function named "send". You will have to check the MDM documentation as I am not familiar with the software.
May 20 '10 #2

P: 9
Hey dwblas! Thanks for the fast response! There is no problem with MDM, because the same version of Python is running on friend's computer, and there it is just fine. I suspect my USB to RS232 converter is the problem, but on the other hand with Hyper Terminal it is works good.
May 20 '10 #3

Expert 100+
P: 391
I tend to use pyvisa for my RS232 control. But it depends what you're trying to do. And you'll need to install something like the NI visa drivers to get it to work. Are you running windows?

I haven't used MDM, but is the 5 in the second parameter an address? Maybe the address is different on the two machines?
May 21 '10 #4

P: 9
ok... so as i was suspecting the problem was the converter from USB to RS232. i have connected the Computer to the terminal with the RS 232 cable abd it is run without any problem.
tnx to all!
May 23 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.