What library/libraries do I need to add in order to communicate with an Arduino from my desktop Visual C++ application? At this point, all I really want to do is make an LED flash (write high/low to a pin). I already have the desktop application going, but would like it to interact with the Arduino. No, Arduino Uno is not suitable for my case.
Edit 1 Also: I am using a serial USB COM port to connect to the Arduino.
Edit 2 While I am programming in Windows, the application will be designed for Windows or Android.
In the Arduino side, you can just use the built-in Serial to send and receive data.
In the desktop side, refer to this question, which tells you how you can talk to Serial ports in Visual C++
EDIT:
If you are planning to use Java, then you can use the Java Serial port library without any changes to the Arduino code.
Also I would recommend you to use the Android APIs if you want to create an Android app. Using NDK is a real pain and unless you know what you are doing, it will be very tough.
With the arduino connected as a serial device you can have software in the middle which connects it to a network socket.
If you google it you'll find several free programs that do this.
You could even write this yourself in a higher programming language (python, perl, php etc..) very easily, it's just a handful of lines of code.
Then it's quite painless to connect to the arduino, whether its c++ or javascript.
Related
I use the BLED112 and want to make it act like a HID keyboard.
The BLED112 receives the keystroke from the Mobile. For example, "p".
Then the dongle act like a keyboard so we can see the "p" is written on Notepad of PC.
Sending data from Mobile to dongle is not matter. I have already done.
My problem is to send the keystroke event to the PC so the dongle works like a keyboard.
I want an example or the full guide.
Thanks.
BLED112 is a Bluetooth Low Energy dongle provided by Bluegiga (Now acquired by Silicon labs). If you have studied the BLED112 user manual and bluegiga API reference documents, you'd understand that there can be two possible ways to read/write data via BLED112:
Use bgscript
use the bglib library into your C/C++ application
BLED112 is enumerated as a virual com port. I don't recall the name of the windows application that comes with BLED112 but it sounded like BLEGUI or something. This application uses the APIs to handle connections, read and write events. In a nutshell, you need to implement the same thing that this application does. For that, you can leverage the logs it spits on the console. This log will help you with all the commands you need to send and all the response that you need to handle.
Then, you need to make your application communicate with the virtual com port over which these commands will be send and responses will be received at.
Once you establish this, you'd be able to display your keystrokes.
It is a substantial work if you haven't worked with BLE. But like people say, there aren't free lunches!
Is it possible to write an API with Python so you can connect a physical ON and OFF switch via USB to a PC and when user presses the switch to ON or OFF, the python program detects it and send a signal to a web app and shows ON or OFF message on the website?
I am sorry if what I am asking its not clear enough!
Yes, it is possible. Reading USB devices can be done with Python. In linux USB device inputs can be found in some files(e.g. /dev/ttyUSB0). By reading those files you can get the information that you need. Putting here link that will be helpful
similar post
Firstly, you can't write an API to interact with hardware in python. You would have to use the pre-existing windows API(or the API provided by the Operating system that you are using) in order to interact with hardware in such a high-level language.
If you want to interact with hardware in python, and detect switch presses, releases etc, I would recommend you used a microcontroller such as a raspberry pi(for python) or an arduino(for C++). The respberry pi provides a very easy way to interact with hardware in python. If you still want to interact with a USB stick in python(but not acting as a switch) you can use the pyusb library.
I have recently purchased an RFID reader that uses RS232 communication. What I want to do is essentially to use this reader on my Raspberry Pi(which does not use x86 architecture). However the seller only sent me SDKs that uses .DLL for C#, Visual C, Delphi and even for Java SDKs!
I tried looking for generic SDKs online but couldn't really find any.
My question is is there any way to convert these into Linux compatible that would work with any other architecture?
Since the Raspberry Pi uses an ARM architecture you are most likely out of luck as the DLL SDK is probably x86 architecture only.
But don't give up hope. You still have more options:
You may be able to use a Minnowboard and get x86 Linux with Wine running under it and make use of the DLLs that way. I believe the Wine COM port code is pretty stable.
If it is truly an RS-232 you should be able to hook the reader up to the serial port of a Raspberry Pi, set your com settings ('baud', stop bits, parity, handshake) with stty and read the output of the reader in Linux. It should be a simple dump of the RFID interrogations.
You may need to do a little bit of protocol reverse engineering, but for a RFID reader this should be pretty easy (about as easy as it gets). If you need to, you might be able to dig up some stuff on-line or ask the manufacturer for the device communication protocol specs.
Here's a link to a serial library for the Raspberry Pi in straight C that should get you going.
For my project I have an Android phone and an Arduino device that communicate via Bluetooth. I was wondering if anyone knows any software tools I could use to monitor a bluetooth communications between two devices. Something like a packet eavesdropping. Preferably for Linux.
Take a look at ubertooth one. In the linked webpage there are instructions on how to build the dongle, as well as links to shops selling assembled dongles may be bought. Ubertooth one should work well with Kismet, and thus in Linux, by using a BT plugin (disclaimer: I have no personal experience on this).
Sounds like you are after a Bluetooth sniffer.
Bad news: They are almost exclusively Windows OS based and cost mega-$.
http://www.fte.com/products/bluetooth.aspx
If you were using BlueZ for one side of the communication you could use the BlueZ HCIDUMP app and Wireshark.
I don't think anyone has made a Linuz/Bluez Sniffer - could be wrong.
I am writing a windows application (written entirely in C++) which reads files from a storage card on a mobile phone running Windows Mobile. The tough part is, I don't know how to make my application detect the event that a user has connected the mobile phone to the USB of laptop. I did some reading on MSDN and have written a small code using RegisterDeviceNotification, which detects whenever a USB disk is attached/removed from the laptop. However, I am unable to tweak this to make it work for phone type devices. Please help me out through any links/tutroials which explains this(preferrably C++, as I don't know .NET or C#).
Thanks
Alok
According to this article you can use RegisterDeviceNotification to get notifications when activesync detects a device has been plugged/unplugged. (See option 3 at the end of the article)
It may just be a matter of setting up the correct notification filter.
Windows Mobile devices use RNDIS, a network interface protocol behind the scenes. Hence, the RegisterDeviceNotification method still works, but you're looking for a DEV_BROADCAST_DEVICEINTERFACE, not DEV_BROADCAST_VOLUME. (i.e. dbch_devicetype==DBT_DEVTYP_DEVICEINTERFACE)
You can use RAPI or RAPI2 to detect when a Windows Mobile device connects to a PC via Active Sync or Windows Mobile Device Center. RAPI can also be used to read the files on the storage card and much more.
RAPI is simpler to program because it is a C based API. RAPI2 has more functionality than RAPI, but is an object oriented COM API. If your needs are simple and you only care about one device/connection at a time then RAPI is good enough. There are two RAPI functions used to detect connections: CeRapiInit (blocking), and CeRapiInitEx (signals an event upon connection).