Getting input back into the teensy.

Status
Not open for further replies.

utronix

New member
Hi All

I have a lot of repetitive tasks that i want to do and fancied trying to use the teensy, mainly to further my programming knowledge.

The first question much be "is it possible" for the teensy to automatically open excel, then read cell's do some processing and write the result of a calculation to a different cell.

Thanks in advance
Steve
 
It is certainly possible to use a Teensy to update an Excel spreadsheet. You'll need to find or write a program to talk to Excel and to talk to the USB Serial port. This has nothing to do with the Teensy per se. You might write this 'adapter' program in Visual Basic for Applications or some other Microsoft language that is able to talk to Excel and is also able to open a COM port to talk to the Teensy.

Once you've got that, sending commands and parameters to the Teensy and reading the output is straightforward. In your Teensy application (aka sketch), Serial.read(), Serial.available(), and Serial.print() will help you with reading and writing to the COM port.

This setup would enable you to update a counter in the spreadsheet that counts the number of times you touch a piece of metal wired to the Teensy, for example. Or maybe the LED on the Teensy gets turned on whenever a certain cell in the spreadsheet exceeds a predefined threshold.

If you don't need to use Excel, the exercise becomes much easier. You could make a little command line interface for your Teensy and type commands at it in a terminal emulator. Or you do like I do and run a web server that sends commands to an attached Teensy, so you can click a button on a web page and make the Teensy turn on the room lights, etc.
 
"is it possible" for the teensy to automatically open excel
Not directly. The Teensy can't just cause Excel to run on the PC without you helping it along.
Look at PLX-DAQ which is an add-on macro for Excel which allows Excel to be controlled by an external device which writes commands to a COM port. PLX-DAQ is described in the Arduino forum here but Teensy (or any other controller) can use it too.

then read cell's do some processing and write the result of a calculation to a different cell
This can be done, but what is the Teensy going to do that Excel can't do itself?

Pete
 
Thanks for the concise reply. As it happens excel was just going to be the "middle man" having been populated from a webpage. Ideally what I would like to do is ha e the teensy logon to my back-end website and get some data. But I need to find out where to look for information to enable me to do that. The first hurdle is to log on wether that is via a connected teensy using USB or a network adapter. My preference would be USB as it can emulate a keyboard therefore needing less hardware. Secondly I would need some way of the teensy knowing that it has logged on before it starts sensing commands.

In summary I guess I'm saying can you point me in the direction of information on how the teensy would know if the log on command was successful
 
Key point here with logging on would be if you are using a serial terminal on the server in question, which is easy enough since the characters come back or if going the USB keyboard route that means the only feedback is to a screen.

The serial terminal route has a lot going for it, but probably works better as something like a Pi with more processing power and more projects that have already gone the route.

With a teensy it's going to be blindly clicking a mouse and doing keypresses. This may be good enough for what you want but means that if something as simple as an error popup happens you can get all sorts of exciting things happening. And generally you don't want exciting things on a server.

I'm assuming you don't have the access to actually just write a script to run on the server directly and skip all these steps?
 
Status
Not open for further replies.
Back
Top