0

This is the idea. I have 2 Arduinos. One with an IR LED and the other with an IR receiver. I want to read the values of multiple sensors and transmit it to the other Arduino via IR. I know how to send data like a fixed HEX code but I dont know how to send values from a potentiometer.

Just think of how a quadcopter sends and receives data from the joysticks, thats somewhat what I want to do.

[EDIT]

This is a precision of what I want to do. I'll read the values of let's say 2 potentiometers, map the values from 0-99, and then I want to send it to the other Arduino with IR and not anything else.

  • The protocol used by toy IR helicopters has been thoroughly reverse engineered and documented, you should be able to find it with a web search. – Chris Stratton Oct 25 '16 at 2:19
  • Is your question: "How do I send a variable by IR as opposed to a constant?" Or is there more to it? – Nick Gammon Oct 25 '16 at 8:30
  • @NickGammon, yes. – Dat Ha Oct 25 '16 at 11:38
  • Well, if you can manage with 8-bit data, just send a byte at a time. Otherwise you need some sort of protocol, like <123> and have the receiving end detect the delimiters. That's what the answer by axa said. – Nick Gammon Oct 25 '16 at 20:58
-1

Seems to me you first need to establish a protocol. Could just be a simple one you make up, with it you will eventually find that repetition and retransmission will need to be explored, and you may want to include things such as a CRC if the application suits it; or not...

As part of the thought process you need to look at your sensors, see how they put out their data, you seem to indicate analog, so that would be read on an a to d converter and that d value might be directly sent as the data part of your chosen protocol.

Or some joysticks packages might have have a I2C or SPI driver built in to which the A to D wouldn't be required.

But using IR you will find timing and validation very important so that the receiver knows where the beginning and end of data is at.

Thinking about it there must some libraries out there already. Or entirely completed projects to study.

Now you didn't ask but if reliable communication is desired you might want to go wired serial or use a managed protocol like an Ethernet peripheral.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.