Raspberry Pi 4 - hardware access? lazarus / 32-Linux ---------------------------------------------------------------------- AlanTheBeast · 2021-02-07 16:52 Where I think I'm going: 1) FPC - maybe under Lazarus - to do some h/w experiments on Raspberry Pi 4. Will need GPIO access. Will need I2C interfacing. How practical / doable with FPC under the Raspberry Pi Linux is this? 2) With FPC or Lazarus on a Mac can I cross compile to the Raspberry Pi? ---------------------------------------------------------------------- ojz0r · 2021-02-07 17:07 It depends how you define pratical. I have a Pi with GPIO and SPI (havent tried I2C yet) access running a pascal application right now. You can write the code in a textfile with postfix .pas and compile it on the Raspberry Pi itself. Just apt install the freepascal compiler. ---------------------------------------------------------------------- AlanTheBeast · 2021-02-07 17:28 Thanks, Can you send me some sample source for setting pin configs, inputs, outputs... I want to get a feel for it. Have you done anything with interrupts? (I've been using an Arduino so far with its atrocious "C".  Can't wait to be on a "real" computer.) Can input pins be configured as pullup on the Pi or do I need to supply a pullup resistor? I suppose that I can network the Mac to the Pi and do my editing on here and just write the file to the Pi for compiling.  TBD. Thanks again! ---------------------------------------------------------------------- MarkMLl · 2021-02-07 17:29 I agree with that, and there's plenty of examples etc. in the wiki https://wiki.freepascal.org/Main_Page MarkMLl ---------------------------------------------------------------------- dseligo · 2021-02-07 17:36 Quote from: AlanTheBeast on February 07, 2021, 06:28:23 pmCan you send me some sample source for setting pin configs, inputs, outputs... I want to get a feel for it. https://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#Accessing_external _hardware ---------------------------------------------------------------------- AlanTheBeast · 2021-02-07 17:39 Thanks MarkMLI - good examples there. dseligo ... I was on that page when you posted... More than enough to get me going ... I just need to learn the Laz IDE - which I'll do on the Mac ... I'll also be looking to code some in assembler (because: masochism).  That's down the road a bit... ---------------------------------------------------------------------- MarkMLl · 2021-02-07 17:54 Quote from: AlanTheBeast on February 07, 2021, 06:39:09 pmThanks MarkMLI - good examples there. When you have specific questions don't hesitate to come back. But you will get definite brownie points for (a) attaching cut-down but compilable code so people can try to duplicate your problems and (b) if you need to quote chunks of code use the appropriate tags (the forum's UI will help you) since otherwise stuff will get mnagled which won't make life easy for anybody. The wiki's fairly good but remember that it's very much "best effort" so if you come across something that doesn't make sense ask. Two other useful links: https://www.freepascal.org/docs.html https://lazarus-ccr.sourceforge.io/docs/lcl/ MarkMLl ---------------------------------------------------------------------- AlanTheBeast · 2021-02-07 18:04 Thanks Again Mark, I sometimes have issues getting going in a new environment, but once clear of startup obstacles I'm off to the races... Cheers!