I think my issue is simple, but I have hit a brick wall. I am not a programmer but needed a program to control a laser engraver via Arduino. My Original code was mostly working, but I wanted the ability to select a serial port with a QComboBox so I can make it software available for everyone.
I figured out how to do that with the code below:
// 3 unbalanced kernels
c=a+b // old 1st kernel
d[i]=sin(c[i+1])+cos(c[i-1]) // old 2nd kernel but dependent to neighbours
e[i]=raytrace(d[i]); // old 3rd kernel that is time consuming
// 2 more balanced kernels
c=a+b; // new kernel-1
d0[i]=sin(c[i]); // new kernel-1 (decomposed 2nd old-kernel part 1)
d1[i]=cos(c[i]); // new kernel-2 (decomposed 2nd old-kernel part 2)
e[i+1]=raytrace(d1[i]+d2[i+2]);// new kernel-2
Now my problem is that none of my buttons work because "ser" is not globally defined. I understand that I broke that when I removed "ser = serial.Serial(port=COM3)" when it was above the class definition, but I don't know how to fix it. Any help would be greatly appreciated.
Cheers!
答案 0 :(得分:0)
A simple solution would be to just set max-attributes=12
as attribute of your ser
instance. Also it couldn't hurt to close the serial connection if it is open before opening a new one, e.g:
Main