This is my first time to post. Hope this is right place to post about control Arduino. I would like to use Lazarus with Arduino. My computer is window 10. I just download Lazarus and got it working. I have been use Delphi 5 for a long time. Installer Ipad Dans Voiture there.

Communication; Power supplies. The demonstration's master device was programmed with Delphi. The system uses a dedicated serial link, leaving the Arduino's.

Now I would like to learn how we can control Arduino with several LEDs and servos. I have google it but still not understand how to use. I understand we need to download serial port communication. Which one should we use? I would like to use USB port. Someone mention to use Synaser. I am not sure How do we use it.

Arduino Delphi Serial Communication Protocols

Is there a step by step instruction how we add serial componet on Lazarus? Is there a webpage where I can download and run it? I just want to control Arduino with several LEDs at first then I will add some servos. Please don't give me the link to YouTube. I am very hard of hearing and having hard time to understand video.

I am 58 years old. @dogriz No need for C.

FPC supports AVR, and afaik it can target the ATMega328 directly. It is also possible to control an ATMega328 from any of the Lazarus supported platforms with software written for that platform. You just have to build a ppcrossavr compiler using the GNU C toolchain for AVR to compile for the ATmega328 itself. So: - you can write controlling software for atmega with Lazarus on e.g., linux.mac, windows - you can target the ATMega328 directly with an FPC cross compiler. (ignore the warning: the current state works). For serial port communication in your Lazarus application take a look at these links: You will find small examples to get you started, but first you need to decide which serial lib/component to use.

Arduino Delphi Serial Communication Protocols

Wiki will help you with the choice. Have in mind that Synaser is not event based. Any of them will be able to talk to Arduino over USB virtual COM port. For developing Arduino and other ATMEL AVR microcontrollers in Pascal take a look at these links: Using forum search would bring you much more links. You are asking for serial communication, but your topic mentions ENC28J60 which can be used for Arduino TCP or UDP networking communication.

If you decide to go that path instead then you can use Synapse, Dataport, Indy and several other networking communication libraries available for Free Pascal and Lazarus. Avra, Thank you for the information and links. I will try find time to work on it next week. Right now I would like to try use Ardunio UNO to make several LEDs to turn on and off from computer. In future I would like to control four or five Arduino with single one com or something.

They are about ten feet apart each other. I will use it for HO train. I would like to control about 25 turnout, several RFID,and lot of LEDs. I thought I could use IC2 but it is my understand it will not work if it is long distance.

I rather not to use Wi-Fi. I was thinking to use ENC28J60 with Nano.

Can we use five ENC28J60 with Nano and switch hub to computer with FPC. If we can then how do we do it?

You can control them from any computer with serial port (yes, including Raspberry Pi) if you use some single master multi slaves protocol. On electrical level it can be RS485 - either 4 wires full duplex or 2 wires half duplex. So you will need 1 RS232-RS485 convertor for your computer, and one for each Arduino.

Make sure that your Arduinos have RS232 and not only USB, otherwise you will need different level convertor like TTL-RS485 or USB-RS485). On protocol level it can be MODBUS RTU or ASCII, some other protocol, or even your own if you want to keep it simple. To be able to talk to everyone, all sides need to have unified electrical connection level and talk the same protocol. There are MODBUS libraries available for FPC and as Arduino C libraries. E-Lab AvrCo Pascal compiler has it, and I think that I have seen one for mikroPascal.

Your board will have different MODBUS adresses, and when your PC asks for data from board 1 with address 1, only board 1 will answer. Then you ask for data from other boards one by one. Unlike W5100 and similar, ENC28J60 is a very simple chip capable to talk just UDP. However some libraries extend it and add TCP/IP layer and other popular protocols. You can talk with ENC28J60 from E-Lab AvrCo pascal, mikroPascal and Arduino C. All boards and your master PC should be connected to a ethernet switch. Your PC would then just need to call boards one by one in a loop and request data from them.

You can use MODBUS TCP protocol for ethernet, but you have very limited resources so you might want to keep it simple and light and instead implement your own request/reply data exchange protocol. OK, then to get some confidence do the most simple thing first. Connect led to your Arduino using proper resistor. Light a led on and off using Arduino IDE for writing a very simple C program.

Flash it to your Arduino and verify that the led blinks. After that use Arduino IDE to write another C program that listens to serial port to change led state with serial 'on' and 'off' commands. To test it use some terminal software, connect to proper serial port (check that port speed and other settings match Arduino port settings), and type on and off commands.

Verify that Arduino led obeys your commands. For all this you can find a nice tutorial here: All you need to do now is to make a Lazarus application that will send serial commands to Arduino like you did previously by hand with your terminal. Avra, Sorry for taking so long to respond. I was travel a lot for my company. I fiinlly be home few days. Anyway I got Arduino IDE working with Arduino Mega to turn on and off LED.

Now I trying to get small Lazarus program that I create a button for one and another button for off. I think I am not sure how to use serial code and where do we put in Lazarus. Is there somewhere I can get more tutor on serial port on Lazarus or where I can download and already have source code and exe file that I can run?

- - - - - - - - - Delphi tutorial: serial comms, i.e. Using the COM port Bi-directional Communications 'Master'/'Slave' two computer system This has good information, and a search button at the bottom of the page Please don't dismiss it because it isn't full of graphics, scripts, cookies, etc! I am old fashioned. I disavow any responsibility for things you may elect to do. In particular, I disavow any responsibility for any consequences arising from connections you make between devices.

You can't just plug 'anything' into your computer or anything else! In particular, make sure that you aren't assuming that an RS-232 interface can be connected directly to, say, an or BASICstamp, or PIC or other. There are notes on some of those issues on, for those of you who need them.

Enough 'lawyer feeding'. Let's turn to the Fun Stuff. If you have already read my page 'dt4r' (the illustrations just a little way down the page will be familiar), you can that isn't duplicated THERE! This is one of the more advanced tutorials in a series which shows you how to link two devices using serial comms. In the tutorials, the 'devices' are a Windows PC running programs written with Delphi and an. However: Either device could be replaced by another.

Many of the issues discussed here are general, but I find that principles are best understood when backed up by examples of their application. If you want to know more about the source and format of these pages. Install Task Scheduler Windows Xp Embedded End Of Support here. It may be easier to read this if you re-size the window, so that it does not use the full width of your screen. The Delphi sourcecode is available for download. The Arduino sourcecode is presented here in full, and you can copy it and paste it into your Arduino development environment for compilation and upload to your Arduino.

This page are a bit rough and ready. Explanations are sketchy. But the code DOES work. I'll try to come back to this and improve it later. Challenge Before I present the tutorial: A challenge for you: If you are an advocate of another language, write whatever is needed to connect a PC (or other device) to the Arduino with switch and LED and Arduino program as presented here. In other words, replace what is plugged into the Arduino, but leave the Arduino side of things as it is in the essay below.

If you succeed, and publish the details, with full sourcecode for the language of your choice, I would be glad to post a link to your work here,. Two computers; one system For many years, for a number of different reasons, I've wanted to hook a microprocessor to a 'big' computer, and have them talk to one another. These days (August 2010) I am using the wonderful Arduino for microprocessor projects, and a Windows XP computer for my 'main' work. The material below could be used with other devices. In particular, if your objective is to connect some serial device to a 'big' PC, you will find helpful material, I hope. In the diagram below, if you assume that the 'some serial device' is a PC, you see two PCs attached to the Arduino. The one on the left is there for when you are setting up the Arduino to do whatever you want it to do with the other PC.

It would normally unplugged, taken away after the system had been built. The set up above is pretty general. Even without restricting what it implies, you can have two scenarios. In order to explain the scenarios, I need to say what I mean by 'Master' and 'Slave' in the rest of this essay. A 'master' device is in charge.

The 'slave' device will 'speak when spoken to'. It may get on with various things when it isn't commanded by the master to be doing other things, but it will not 'come up' on the serial channel, aka 'serial link' between master and slave unless the master has told it to. The master may 'speak' to the slave in an imperious manner, just issuing a command, and assuming the slave will execute it without any reply. If, for instance, there was an LED attached to the slave, the master might send a 'turn LED on' command'. Or, the master might 'say' 'Turn on the LED, and tell me that you've done it.'

In the latter case, the master would have to be programmed to look for the slave's reply. You can build systems like the above in which the 'Some Serial Device' is the master, and the Arduino is the slave, and you can build systems the other way around (Arduino as master, other serial device as slave.) In the work so far within this tutorial, an example of a Windows XP computer as master, with an Arduino as slave has been created. (The hard parts of doing the reverse are all solved, and part of the first solution.) It is all well and good thinking in general terms, but eventually it is necessary to get down to cases. For the work to be discussed, this is the set-up I was using. The is a neat, inexpensive solution to the problems arising from the fact that the PC uses RS-232 serial comms and the Arduino is a TLL device. I'll try to expand on that later.

(See my, for a badly written 'answer', in the meantime.('Hardware' section, near top.)) N.B.: The 'Rx'/'Tx' markings on the device, and on the diagram above cause people no end of confusion. They stand for 'transmit' and 'receive'. But relative to which device??? There's a signal FROM the PC TO the Arduino that is marked 'Tx' above. And we are transmitting from the PC to the Arduino.

But the Arduino might well call that line 'Rx', as it is the line the Arduino is receiving on. Not rocket science, but easy to get turned around. Follow the diagram: Connect the signal marked 'Tx' on the PA4B to digital pin '3' of the Arduino, the signal marked 'Rx' on the PA4B to digital pin '4' of the Arduino, enter the Arduino programs given below, and all will be well.