Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

How to activate Raspi internal pull-ups and pull-downs

yann2021
2021-06-06
2021-07-04
  • yann2021

    yann2021 - 2021-06-18

    Hello aseitzinger,

    Many thanks for your reply. Far too complicated for me! I will simply put external pull up / pull down resistors ! :-D

     
  • nothinrandom

    nothinrandom - 2021-07-04

    @yann2021,

    I believe you should be able to achieve this inside of CoDeSys.
    1) Find this file /etc/CODESYSControl_User.cfg and add the following to it:

    [SysProcess]
    Command=AllowAll
    

    2) In your project, add the SysProcess library in Library Manager and execute the following command (example to set pin 18 to pull-up):

    SysProcess.SysProcessExecuteCommand2(pszCommand := 'gpio -g mode 18 up');
    

    Another example to set it as output:

    SysProcess.SysProcessExecuteCommand2(pszCommand := 'gpio -1 mode 18 out');
    
     

Log in to post a comment.