pinMode INPUT can not digitalWrite HIGH?

Hi, I find Arduino code like blow not work for spark? How can I set INPUT mode pin HIGH?

#define REC_BUTTON 7

void setup() {

  digitalWrite(REC_BUTTON, HIGH);

An input is used for measuring things, generally speaking. Setting a pin HIGH is output. Why would you want to set an input pin HIGH like that?
If it’s meant to act as a pull-up, simply use the appropriate code:

Also, please define your pin as “D7”, rather than just “7”, since we’ve got both digital and analog with similar numbers.

1 Like

@rhoulay, on the Arduino platforms, writing a HIGH to an input is used for activating a pull-up resistor on that input. On Particle devices, the pinMode() commands is used with an explicit mode to specify PULLUP or PULLDOWN resistors like this for example:


Refer to the documentation for more intormation :smile:


The solution @peekay123 has pointed out has even become part of the Arduino standard
Look at