Asked — Edited

Getdigital() Function Sets Digital Port On Rendering It Useless

getdigital() function sets digital port on rendering it useless.

Tried on different boards. Will try from a different computer but if anyone has the same bug, please let me know.

Updated ARC to last version.

Thanks,

Elfege


ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

PRO
Synthiam
#1  

Can you explain this message please?

Are you stating that when you get digital, the port is now in a digital read state? As the name implies? More information is necessary.

If this helps, it's worth knowing that a microcontroller pin on any chip in existence can only be in one peripheral state at a time...

Those states are either input or output, hence the I/o. The abbreviation of I/o stands for input output. You can find out more in the ezb tutorial where port types are explained, including what adc and serial is...

If your code reads a digital port, it becomes input and floats the output. So, if you set a digital port value and then read from the digital port, you lose the value for that reason.

#2  

If i try to read the value of a port that is on low mode, the port switches to high , exactly ly as if getdigital(D8) was a set(d8,on).

PRO
Synthiam
#3  

It switches to FLOAT - which may appear "high" because it's floating. Floating means it will conduct static electricity and any voltage on the wire. If you wish to check for an input, ensure the device connected has a resistor to high or low, based on the desired state.

In this case, the resistor would be referred to as a pull-up or pull-down.

Here's some search results for assistance:

  1. how to wire a button https://synthiam.com/Community/Questions/5834

  2. ADC Ports (i know this is adc and not digital, but the same method applies) https://synthiam.com/Community/Questions/8808

Lastly, if you're switching the port type programatically, expect issues. For example, if you're using the port as a servo and use a GetDigital(), that won't work. If you're the port with Set() and then GetDigital(), that won't work. This is because you've configured the port for a specific peripheral and attempting to perform a command that is not supported by that peripheral.