LVMakerHub / LINX

LabVIEW Community Edition LINX
Other
108 stars 114 forks source link

Feature request: Control (enable/disable) internal pullup resistor on Digital pin in Arduino #63

Open Ryton opened 9 years ago

Ryton commented 9 years ago

Hi,

in the device lib, there is a function "Digital pin mode" (under Private/device/Peripheral / Digital) which allows to set the digital pin mode for an arduino to either INPUT or OUTPUT. However, there is a 3rd option, enabling the internal pullup resistor, setting the mode to "INPUT_PULLUP".

Could this be added to the library? I tried this myself, since I saw that the LINX firmware for Arduino is already programmed so that it should be possible to send an INPUT_PULLUP command from Labview, but I didn't manage to activate the state of the pullup trough this method. Maybe it's case sensitive? (Didn't measure +4.9 V level on the pin with a DMM).

PS: Also, at this moment, whenever linxDigitalRead() is executed, the pinmode is -again- set to INPUT in the firmware code. If the input_PULLUP option is going to be implemented, INPUT_PULLUP should become an optional flag (with INPUT as default value) in this LinxDigitalRead() function, accessible from Labview as well.

From LINX.ino (arduino)

void linxDigitalRead(unsigned char* commandPacketBuffer, unsigned char* responsePacketBuffer) ... //Set Pin As Input (Might Make This Configurable) pinMode(pinNumber, INPUT); //Read Pin And Insert Value Into retVal retVal = retVal | (digitalRead(pinNumber) << bitOffset);

samkristoff commented 9 years ago

Closing Duplicate of this issue (leaving this one open for now) See https://www.labviewhacker.com/forums/viewtopic.php?f=11&t=480

https://github.com/MakerHub/LINX/issues/65