PIN output check with PIN INPUT

Hello,
Let me start by saying that I do not know anything about electrical engineering so please be forgiving :slight_smile:

If I set pin 9 for output and pin 1 for input and set pin 9 to 1, shouldn’t I read 65535?
Also, should I have any readings while nothing is connected to input?

You haven’t mentioned it, but have you specifically configured pin 1 to be an ‘analog’ input?

input <- hardware.pin1; input.configure(ANALOG_IN);
If so, and you’ve set pin 9 to the high state (and I assume connected it to pin 1), then I believe you should read something near 65535. What reading do you get?

And yes, you should get a reading even if nothing is connected to the input, it would just be uncertain.

(Note: there have been some reported isolated problems with pin 1 mechanical intermittents on imp-001 devices, but let’s make sure you have your pins configured properly first).

Yes, that is how I configured pin 1. I also tried to use pin 3 and 5 as input and 7 and 8 as output but all I read is random values. If I connect an led it is not powering on either unless I connect it to 3.3v. That happens even with the standard blink example.

Thank you for your help!

Hmmm … seems to work fine for me. Try the following code. (It toggles pin 9 between high and low every 2 sec). I get alternating readings between near 0 and near 65535. The values are indeed a bit random (this is normal), but very near the endpoints (i.e. 0 and 65535). Are you expecting solid values?

`input <- hardware.pin1;
input.configure(ANALOG_IN);

output <- hardware.pin9;
output.configure(DIGITAL_OUT);

state <- 0;

function poll() {
state = state ? 0 : 1; // toggle state
output.write(state); // write the output
server.log(input.read()); // read the input
imp.wakeup(2.0, poll); // do it again in 2 sec
}

poll();
`

That is what I tried and my values are between 300-400 and 30.000-40.000. Far from the endpoints. It is my second electric imp as well. The first one did not power on at all.

Dead imps are pretty rare (unless they’ve been exposed to overvoltage/reverse voltage).

What board is the imp plugged into?

Just an fyi @Romeop, all my readings were < 64 and > ~65250 … i.e. pretty close to supply rail voltages. (I was just testing with an -001 in an April breakout).

As @Hugo mentions, it would be interesting to know what board you’re running, what version imp you’re using (I’ve been assuming an -001), and also what the actual Vdd is at your device.

Looks as if you’re getting some kinda readings … the values however suggest perhaps something funky with your supply voltage.

@Hugo and @LarryJ. This is going to be pretty embarrassing :). The problem was my bad soldering… Soldered again and it works great! The first imp I got was indeed dead. I purchased it from makershed and I plugged it into the same USB as the one I currently have this one and it wouldn’t power on. I got a replacement eventually and this one works great.

The imp is exactly what I needed for my product! I will soon get in touch with the sales team as I have a couple matters I would like to discuss.

Thank you very much for your fast and elaborate answers.

PS: I was using the imp 001 and the april board

Do not try to use cheap SD card connectors, I found out the hard way how much they suck.

I had an April board which I got on a breadboard, and when I connected my weather sensors to that it worked just fine. But when I connected the same sensors to the PCB I had made, the readings didn’t make sense at all.

Turned out to be a bad connection between the imp001 and the card connector, so the analog reading I was looking for was way off.

Thank you for the advice. I will do quite a bit of testing before it goes out. I am currently using the April board for development