freelanceprogrammers.org Forum Index » Delphi
importing python class
Joined: 29 Sep 2006
Posts: 4
importing python class
DearSir
I am a new baby to pythondelphi forum. I am
trying to get set some analogue values from my
microcontroller pic 18f4550 via rs232 using python
commands
import serial
s=serial.Srial(0,9600,8,1)//accesing COM PORT1
s.flush()
v=s.read()
print v
i got success to get analogu value
then i tried to use this int v retun by python
in delphi using delphipython variable . i got success
I want to read array of analogue varriables
return by python in delphi.and want to plot a curve
i wrote a class using serial communication
I tried porting python class using import
here is the class
function
class mk
fd=None
def init(self, port=0):
self.fd = serial.Serial(port, 9600, stopbits=1,
timeout = 0, parity=serial.PARITY_NONE)
self.fd.flush()
def read_adc(self):
self.fd.write(chr(ADCREAD))
res = self.fd.read()
return (res)
i got v as variant . when i tired to show the value
using shoe method i got nothing
in python command i got v as 5
while poting class using import function
i got nothing pl help me
here is the code
begin
mymodule := Import(`nk`);
obj := mymodule.mk();
obj.init(0);// initating com port 1
v:= obj.read_adc();// reading
Edit1.Text:= v;displaying value
showmessage(v);
end;
pl help how can import aray of varables retuned by
pyhon to delphi
M.Kathiresan
Sub Divisional Engineer
Mobile communications
india
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







