473,516 Members | 3,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem i am experiencing with Python "send" command.

9 New Member
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
  4.  
  5. MDM.send("AT#ADC\r", 5)
  6. a = MDM.receive(20)
  7. print "AT#ADC:%s\r" % a
  8.  
  9. print 'sleep 0,5 seconds\r'
  10. MOD.sleep(5)
  11.  
  12. trial = 0
  13. while (1 == 1):
  14.     trial = trial + 1
  15.     print 'loop %d:\r' % trial
  16.  
  17.     MDM.send("AT#ADC=1,2\r", 5)
  18.     a = MDM.receive(20)
  19.     print "\tAT#ADC=1,2 --> %s\r" % a
  20.  
  21.     mv = GPIO.getADC(1)
  22.     print "GPIO.getADC(1) --> %d mV\r" % mv
  23.  
  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\ADC_test.py", 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
4 2519
dwblas
626 Recognized Expert Contributor
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
dima81
9 New Member
@dwblas
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
Glenton
391 Recognized Expert Contributor
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
dima81
9 New Member
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

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

Similar topics

2
1696
by: Peter Gordon | last post by:
Is there somethin like tcl "send" command in Python. I would like to be able to exucate calls in a python program on one machine from another machine.
3
7188
by: Kurda Yon | last post by:
Sorry for a very stupid question. Can you tell me what does the following html source does if I press button "Send"? If I read this code by Netscaspe from my local file system and then press "Send", I see in my browser directory where the considered html source is located. If I publish the given html source, open published page and again...
2
6237
by: Gary | last post by:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)"); This is not working ..what could be the reason..? Situation: I have a menu in my form, which is given a short key "Ctrl+P", now when the
4
4268
by: Rvo | last post by:
Hi all, I need to use the Netware "send" function to send messages to some/all attached netware users on a server. However, I can't find any documentation on this topic on the Novell site or anywhere else. If any of you has experience on this topic (or knows of any online documentation about it) I would realy appreciate your help. (Which...
0
1477
by: bruce | last post by:
I'm testing a very simple web services called Add (take 2 integers and return the result). The service program is done in VS.NET and work well using HTTP POST. I wrote a simple (Classic) ASP SOAP Client on the same server (let's call it server A) where the web service is hosted, and it can consume the service just fine. The asp client looks...
28
2956
by: john_sips_tea | last post by:
Just tried Ruby over the past two days. I won't bore you with the reasons I didn't like it, however one thing really struck me about it that I think we (the Python community) can learn from. Ruby has ... an issue with docs. That is to say, there are almost none. Well, actually, there are some. For example, the "PickAxe" book (google it),...
5
1150
by: Sweet.mhtrq | last post by:
I want to use "send" to send a string like Code: send "p" & OutputString if OutputString is "1234" , "p1234" will be sent. but it is sent too fast, my robot' cpu cant receive the whole string. Sometime it
1
6705
by: samarthkumar84 | last post by:
Hi I had used following code for sending e-mail but facing this problem. I want to send this e-mail in ASP.NET using VB.NET code. I am attaching both code an output. CODE Imports System.Web.HttpCookie Imports System.Web.Mail Imports System.Web.Mail.SmtpMail
1
5879
by: jabdulius | last post by:
Hi all, newb to Perl here. I'm trying to use the Net:SNPP package to send a page, and getting the above error when trying to send. Here's my code: my $host = "snpp.cingular.com:444"; my $snpp = Net::SNPP->new( $host ); $snpp->send( Pager => $to, Message => $message,); $snpp->quit;
0
1921
by: Josh | last post by:
I've had surprisingly little success in finding answers to this by the usual Google search. Putty is great for manual work, but no API exposed. Plink is too asynchronous so scenarios like: pass command, plug response to variable/array/object, then pass to if/else structure then send next command just won't work. I'd think there would be an SSH...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7405
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7574
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3265
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.