페이지 정보작성자 master 작성일2018-09-29 13:37 조회94회 댓글0건
Many Arduino projects have the need to send data to a PC running a program for data aquisition and visualisation. Lazarus is highly suitable for developing such programs, i.e. to build the PC-sided counterpart of an Arduino project.
For Lazarus developers Arduino opens a whole new world of smart physical sensors and actuators for monitoring, control and data acquisition.
The fpc compiler is even capable to compile programs for Arduino boards itself.
FPC on Arduino
Currently (2017) most Arduino boards carry microcontrollers of the AVR family (Atmega). An other popular arduino board carries a STM32 (ARM Cortex). For both microcontroller families there are fpc compilers available. Programming Arduino with FPC of course doesn't mean to use the arduino ecosystem with just a different language. Nevertheless arduino libs (C++) can be used in fpc programms, but mixing languages obviously is an advanced topic. While compilation the fpc creates a .hex-file (binary), this can be loaded to the microcontroller, arduino board respectively, using a programming software by choice. AVRDude e.g. also supports program upload using the Arduino bootloader.
There is also a tutorial on how to use Lazarus on a AtMega328p (Arduino Uno/Nano) in German language: AVR Embedded Tutorial/de
Communication between a Lazarus application and Arduino
The following section describes how your Lazarus/FPC application can communicate with Arduino boards, no matter whether fpc or arduino is running on the arduino board.
Here we show how to communicate with your board through serial communication channel.
Lazarus side serial application
There are many ways for serial communication in Lazarus and FPC.
Minimal Lazarus Synaser serial example
We will use Synaser from Synapse library in this example. Create Lazarus application with one form and two buttons. Include Synaser unit and add Synapse package as a new requirement to your project (you do this in Project Inspector). In OnClick event of both buttons put something like this:
Arduino side serial application
You can program your Arduino in several languages.
Minimal Arduino C sketch serial example
Minimal Arduino mikroPascal serial example
mikroPascal for AVR can be used to develop Arduino programs. TBD.
Minimal Arduino E-Lab AvrCo serial example
E-Lab AvrCo Multitasking Pascal can be used to develop Arduino programs. TBD.
Minimal Arduino FPC serial example
Yes, your Arduino 8-bit AVR board can be programmed with FPC too. TBD.
Here we show how to communicate with your board through ethernet communication channel.
Lazarus side ethernet application
Arduino side ethernet application
등록된 댓글이 없습니다.