Visual Micro
Other >> Project Guidance >> sketches as dll's?

Message started by GregC on Jan 19th, 2014 at 8:30pm

Title: sketches as dll's?
Post by GregC on Jan 19th, 2014 at 8:30pm
Hey!  I've been a VS programmer for several years, but am new to the micro-controller world.  I'm currently working with an Uno with a fingerprint scanner attached.  I want to create a Windows app that will communicate serially with the scanner through the Uno.  I'm thinking a VB GUI with c++ dll's to handle the communication between computer, Uno and scanner.  Can I compile Arduino sketches as dll's?  Is there a better way?

Title: Re: sketches as dll's?
Post by Visual Micro on Jan 20th, 2014 at 2:30am
Hi Greg,

Not sure I fully understand but there are lots of examples on the arduino playground and stackoverlow etc.

I'll add a few quick tips if I understand correctly.


The Arduino code doesn't compile into a windows dll and is always uploaded to the Arduino processor via usb or some other means. The arduino code is capable of sending and receiving Serial.


I expect the scanner is connected to some arduino pins and has a library or some sample code. In that case you can combine the reading and printing of serial on the arduino with the scanner code.


The Vb windows app can use the System.IO name space to read or write to a windows serial port. So your vb app can show UI controls, buttons etc and can forward the commands via a SerialPort such as COM1 at an agreed baud/speed defined in your sketch when you issue a Serial.begin(baudRate) in your arduino code.

Remember that the debugger uses the serial port, this might not be relevant but if it is then post a question and I will point you to a solution.

I hope this helps, there are tons of examples out these for the .NET SerialPort class. You don't need C++ on the windows side of things unless you need pin level port control.

Title: Re: sketches as dll's?
Post by GregC on Jan 20th, 2014 at 12:50pm
Thanks, Tim.  Your comments are on target and helpful.  You've given me a different way of approaching this project.  The fingerprint scanner has several different modes of operation:
*enrolling a new finger in its database
*verifying a finger against that database
*receiving and sending data over the serial line
just to name a few.
You are correct, there are lots of code samples to perform these individual operations.  My original approach was to try to download the particular operation I needed at the time, as a sketch, and continuously download different operation sketches as needed, via the vb ui.  However, it may be better if I combine all the needed operations as functions in one larger sketch and download only once.  Then call each function from my vb ui.  This will eliminate the need for dll's or any other code libraries stored on the computer.  Do you agree that this is a better approach?

Title: Re: sketches as dll's?
Post by Visual Micro on Jan 20th, 2014 at 1:12pm
Hi, Yes that makes good sense to me.

Best of luck

Visual Micro » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2021. All Rights Reserved.