I have an Electric IMP that read counts from a sensor on pin1 by the command count.read. The small code that covers this is:
count <- hardware.pin1;
local time = 60 // time to log pulses for
count.configure(PULSE_COUNTER, time);
local numPulses = 0;
function bigLoop() {
counter = counter +1;
local numPulses = count.read();
Is there something similar for the photon I could use so I could move the application to the photon?
Sorry, if you took my post as scrutinizing yours - it wasn’t meant that way - and "yes!" the example would need looking at too, but I think my point is valid for the a button (which usually means floating pin when not pressed), while the example does not explicitly talk about a button.
I’d rather gather from the use of CHANGE that there is a interrupt source in use that does effectivly provide two defined states for HIGH and LOW, which a button does (usually) not. (But on second read I’ve seen that the OP uses a sensor rather than a button)
As for the pin selection, the example dates back to the Particle Core where such limitations did not exist (but others) and I didn’t say you can’t use these pins, but where possible avoid them.
And despite the fact that my post was marked as reply to you ( @BulldogLowell ), I presset the “Reply” button for the thread and actually wanted to provide helping pointers for the OP and definetly not get a you.
I use the word in its pure sense, no emotion... I didn't intend to impugn your comments!
"Scrutiny" and words like "accountability" and "consequences" seem to somehow gotten a negative wrap... probably because of their excessive use in the corporate world!!
In any case, the OP should be on the right track!!!
yeah... you can use the internal pull-ups/pull-downs or you can use an external resistor (as you did) pulling up to 3V3 or down to ground.
in Arduinoland, you would usually set the pin to INPUT though... but the example in the Particle docs doesn't, so I now want to check to see if the pinMode is set in the attachInterrupt() function.
Thanks for the help! The following now works fine for counting the pulses i receive from the sensor. There are some other stuff there as well but one should get the idea if someone else needs something similar.