Hello , I have to write a code that read a file in python and convert each chaaravter to 1, or 0 and send these digets to a a selonoid to make a strike or not to make ( brille printing ) is that possible ???? please need your help no time left :( :(
It is certainly possible, though without the details of the hardware we probably can't help you beyond a certain point.
What have you done so far? We cannot and will not do the work for you, though we will try to answer direct questions and give advice towards fixing problems. You need to show that you have made a good faith effort to solve the problem yourself.
We would also need to know what version of Python you are using, as Python 2.x is quite different from Python 3.x and the answers we give may depend on the version at hand.
What I can do is suggest that you start with a with statement, which is the conventional way to open and manage a file in modern Python:
with open("file.txt") as f:
data = f.readlines() # get the whole file as a list of strs
This is just one simple example; needless to say, it can be a good deal more elaborate than this.
Untill now I already connect all the hardware (touch screen , 2stepeer motors and the solenoid), and every thing is ok.
but I want to know how to convert each character (I know how to read file ) but how to convert these characters to(zeros and ones)and svae them into a nother file
There are literally thousands of models of stepper motors, solenoids, and touch screens on the market, so that isn't sufficient information for us to help you with. You'll need to check the documentation on the devices in question, or at the very least tell us the make and model of each. It may also help to let us know how you are connecting to the devices (e.g., USB, RS-232 serial, eSATA, HDMI, a proprietary adapter of some kind, etc.).
I doubt anyone here is going to be familiar with the specific hardware, but I may be wrong; if you give us the details we may be able to steer you in the right direction.
I don't think that it will be necessary to know what model they are...
I just wanna the code of how to read a file from a Flash memory using USB port on raspberry and convert each character to another form and send them to the solenoid ... and I think solenoid model will make no difference !!!!!
I'm not sure about the PI as I've never used it... I'm waiting for the prices to drop a tad more. I've read about reading stuff of an SD card and it seems a lot more involved.
The arduino is perfect, whereas with the raspi as it is effectively just a computer, you have to hack/add how it talks to i/o ports, or at the least it is more involved.
With the arduino, assuming you don't need a fully fledged OS, it does it straight out the box. The programming language is simple and intuitive, you don't even need to have an understanding of electronics to get something to work. Having used it I can testify to this.
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...