Closed

# Arduino script for h-bridge reverse polarity and a few extras

This project received 22 bids from talented freelancers with an average bid price of €221 EUR.

€30 - €250 EUR
22
###### Project Description

Dear friends I need you to write a script for Arduino board. I will connect a h-bridge to control electromagnet. I need to change the polarity of the electromagnet very fast - from 100 to 1000 microseconds.

The reversal of polarity will be represented as 0's or 1's as you will see on the attached images.

- I want to be able to change your code and put the sequence of 0's and 1's that I need.

- The code wont be changed very frequently (maybe only to add a few symbols) so you don't need very complex code (simple is always better).

- I will need to put more or less 0's or 1's.

- For every reversal there is a fixed time in microseconds. For example the 1's are always 50% of the time for 0's - if a 0's are 500 microseconds the 1's should be 250 microseconds.

- I will need to have between 100 and 150 (maybe some more) (real example: 00001101101110000011010110101010000110001011100010110000100001011010011111001101100011111100110001010111101101110)

I need to connect 2 LED sensors that will sense the time between the activation/deactivation (example 50 or 60 or 100 ... etc. milliseconds) and based on that time the code and the time for 0's and 1's to be automatically adjusted.

- Example If I have 100 symbols - 50 of them 0´s and 50 will be 1's and the time for all is - 50x250 microseconds (the 1's are half the time of 0's ) + 50x500microseconds = 37500 microseconds (37,5 milliseconds). If the time from the sensors is 50 milliseconds the values of the 0's and 1's should be corrected automatically to suit the time from the sensors (50ms) multiplied by 2 for example (or 1,5; 1,6; 2; 3;4 will be hard coded only once). And so the time from the sensor will be 100ms and so the time of the 0's and 1's should be corrected properly and will not be 250 and 500 microseconds, it will be a litte bit more.

There are only 2 variables after we have the time from sensor - time for 0´s and time or 1´s.

I will accept code that is working, it doesn't matter how is written. Just need an explanation how it is working and where to change it to put more 0's or more 1's and to change the multiplier for the time from the sensors.

I have attached some pictures from internet where you can see how the 0's and 1's are interpreted on magnetic tape.

You can ask me anything you want. I have a little experience with Arduino and you are welcome to suggest whatever you think will suit my needs.

## Hire Freelancers who also bid on this project

• Forbes
• The New York Times
• Time
• Wall Street Journal
• Times Online