Arduino programming

This is a discussion on Arduino programming within the C++ Programming forums, part of the General Programming Boards category; Hi I'm new here, so I'm not quite sure, this is the right place to write, to ask. I'm writing ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    3

    Arduino programming

    Hi
    I'm new here, so I'm not quite sure, this is the right place to write, to ask.

    I'm writing a program for arduino, and I've got into some trouble.

    In the end, I want my program to show the status of a sensor, connected to the arduino. This status must be read from the sensor, stored at EEPROM (arduino storage) and then, when there is no connection to the sensor, the status must be read from EEPROM.

    Actually, in the end there will be two arduinos communicating wireless. But my problem is, when there is connection between the sensor, and the arduino, the sensor sends out HIGH (4V) and LOW (0V). When there is no connection, the arduino must read from EEPROM, BUT it also wants to read from the sensor, and since this is not connected, the arduino receives 0, same as LOW
    How can I program the arduino to distinguish between LOW (0V) and 0 (disconnected)?

    I realle hope you can help, and sorry for bad language, I'm Danish
    One last thing, if anybody answers, I'm no expert on this, so please write some code, you think would work, and then try explain it. I won't be able to write code from an answer...

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Don't know anything about the hardware, but: is there some sort of message you can send to the sensor that says "please respond", or some sort of phone-home capability? (I would be surprised if there's not some way to distinguish "low" from "absent", but you may have to flip through some manuals to find it.)

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    3
    There might be, I hope so.
    I've tried to find it, but I don't really know where to look or what to look for...

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    2,708
    Without knowing anything about how the "sensor" is connected to the Arduino or anything about the "sensor" it is almost impossible to answer your questions.

    The "sensor" may be producing a voltage which the Arduino must convert to a digital value, or it may produce a digital signal.

    But my problem is, when there is connection between the sensor, and the arduino,
    Does this mean that the sensor is physically connected to your Arduino or is this connection also wireless?

    Jim

  5. #5
    Registered User
    Join Date
    Dec 2010
    Posts
    3
    Hi Jim
    The sensor is an inductive sensor, which, when it is HIGH sends out 4V to the arduino. When it is LOW it sends 0V, it produces voltage for the arduino to convert to a digital value.

    At this phase the sensor curcuit is connected to the arduino, but next phase is to communicate wireless with Xbees.

    I hope this was the answers you needed.

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    2,708
    So then the sensor is not just producing 0v or 4v it is producing a voltage between 0 and 4 volts. This means that the sensor should be connected to one of the Arduino AtoD port pins not a digital input/output pin. You need to check out the documentation for your Arduino board to see which pins are connected to the AtoD (Analog to Digital converter), connect your sensor to one of those pins and configure the Arduino to use the AtoD.

    Jim

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21