I need to have a physical button that when pressed will be noticed by my program.
There are many types of usb-buttons that are preprogrammed to open a website, shutdown the computer and so on. And I have seen some projects using buttons and serial port.
But none of them "have it all", an easy description of how to put togheter the hardware, and an easy description of the code.
I really only need a button connected to the serial port that send some signal that the button has been pressed.
I know this question is a crossover between software and hardware, but when I googled this I have seen plenty more people asking this question, all of them left without answers.
Maybe this question fits stackoverflow?
EDIT: My solution
My application in this case was a que system and I wanted a button for people to print a que ticket.
I just took apart an old ps2-mouse and bought me a button (4$) and solded two wires from the circuit board to the button. Each mouse button has to dots on the back of the circuit board that we can connect an external button to.
Then in my program I just hooked the mousebutton-event systemwide to get when the button is pressed, in my case this computer is dedicated to this program so its not a problem.
Might be worth a look at Phidgets:
http://www.phidgets.com/index.php
They do many little USB I/O devices, and the code samples are there on the site too.
I would take a look at the Arduino microcontroller board - you can wire all sorts of things into that (buttons, sensors) and interface with it using the .NET Ports classes.
I'm looking for the same thing. this might do the trick:
http://awatts.co.uk/
Haven't tried it yet, but he has code to run a shell command or simulate a keypress and the source code is available if you need something different.
And for Linux: search freshmeat dot net for usb-panic-button-daemon project. (I'm a new user, and can't post more than one hyperlink!)
And another thing I just found is that Griffin makes an SDK available (at least they used to, I'm waiting for a reply) for their PowerMate knob to get it to simulate more than mostly just keypresses.
BTW I'm looking for USB buttons, but I could use serial too, come to think of it.
Related
for my program, I need to be able to discriminate between when users are performing some actions using gestures on the trackpad and when using corresponding hotkeys. Typically, I need to know when users show desktop, and if he performed an associated hotkey or associated gesture. Same for switching spaces, etc...
Basically, I have this need for showing notification center, application windows, show desktop, show dashboard,etc... Being able to handle hot corners would even be a plus.
So far I was hoping to be able to investigate global monitors for events, using NSAnyEventMask and slightly reverse engineer to figure out what type is the "Mission control open" event, but this was not a success. In fact, NSAnyEventMask does not seem to work at all as my method is never called (while it is with other masks such as keydown or mousemove).
I also had a look at the accessibility features, hoping I could add a relevant AXObserver notification, but did not find anything neither. I guess this is not surprising since the accessibility API provides a description of basic graphical components such as menus, windows, etc... therefore, virtual spaces and notification centers are not described by it.
Finally, CGevent tap does not seem to handle these events as when I use the function keys for showing desktop, the only events handled by my CGeventTaps are the corresponding keydown and keyup events.
I suspect few possible outcomes.
(1) I have been amazing at trying, but unfortunately this is not possible at all to handle these events ... I seriously doubt this as first I am far from being an amazing programmer, especially in Cocoa, and second, apple prove me that this is possible to access lots of amazing events programmatically and I believe in the power of their API.
(2) I have tried the good methods, but failed because of side factors. It is likely.
(3) other methods could help me to handle these events globally and programmatically (private API?).
Thanks a lot for your help,
Kind regards,
Just saw this, but this is caused by an error in Apple's implementation of NSAnyEventMask. The docs describe NSAnyEventMask as 0xffffffffUyet the implementation of NSAnyEventMask is an NSUIntegerMax which is 0xffffffffffffffffU. This is possibly due to the transition from 32 bit to 64 bit computers which changes NSUInteger's from unsigned int's to unsigned long's. Replacing NSAnyEventMask with '0xffffffffU' fixes the problem. I've already listed this as a bug to apple in hopes they would fix this.
Most of touchpads on laptops don't handle multitouch, hence are not able to send swipe gestures to the OS.
Would it be possible to send some gestures to Windows from an external device, like a Teensy, or a recent Arduino, that can already emulate a keyboard and a mouse. I could send buttons 4 and 5 (mouse wheel up and down), but I would like to send a real swipe gesture (for example with a flex sensor...).
One of the ways that you could work with arduino and similar is to use the Microsoft .NET Microframework, which is an open source code, available for no cost from: Micro Framework
There are other frameworks available for the Artuino that you might want to use. So if you have a great idea on how to utilize the sensor hardware, then the output must meet certain specifications.
To be able to connect to your hardware that reads gestures, you will need to understand how drivers are created, so take a look at this: Info on drivers.
To find that type of information you would need to take a look at above link, this is for sensors, which would appear to be not quite what you are looking for, you are looking to use "gestures" but first you have to be able to make the connection to your device, this guide MIGHT help. I have reviewed it for other reasons.
There is a bunch of stuff to dig through, but first of all, imo, is to understand how to get your software to communicate with Windows 8. Let me know if you have any other questions. I am not the best person, you might want to refer to the community at the Micro Framework link shown above.
Good luck.
That's perfectly possible. What your effectively suggesting is that you want to create your own input peripheral like a trackpad and use that to send inputs. As long as windows recognizes this device as an input source it will work.
I am using an Olimex sam7s256 board. I tried to get it up and running in linux (Ubuntu). I was able to successfully install GCC and binutils. I installed SAM-BA for linux from the atmel site. I was able to get the USB port for connection as specified in the SAM-BA manual (.dev/ttyUSB0).
But when I try to use the GUI and 'connect' there is no response.
I though that there is a connection failure, so when I presses the reset button in the board, I get a message "Failed to initialize FLASH accesses".
No matter how long I wait before pressing the reset button, I am not getting any SAM-BA window as given by other tutorials as below
can any one one help me out in this?
I did the 'tst' jumper set, reconnect the board for 10 s, disconnect and 'tst' jumper reset, reconnect before opening SAM-BA.
Any help will be greatly appreciated.
I am stuck.
It is the same for both SAM-BA 2.9 and 2.8.
By this point you are already connected. If you specified the at91sam7256-ek even if you arent using that board it will not put this gui up if it didnt talk to the chip/board. I recently went through this exercise with an olimex sam7s-256 header board. (with ubuntu linux). If I didnt specify the board type then the window came up but it wasnt really connected.
Notice how the code at 0x00200000 is valid instructions (most start with a 0xE and the vector table starts with a bunch of 0xEAs which are branches out of the vector table) that is ram it didnt make those up it read that from somewhere. Load a binary file into ram in the 0x00200000 range and the refresh the memory (assuming your binary is different from what is there) and see it change.
When ready/comfortable you can erase the flash and see in the memory window that the flash (0x0010000 or something like that) changes to all 0xFFFFFFFFs. Now remember it wont boot when you do that. With the board I have there is a jumper you move then power the board to get the built in bootloader re-loaded into the flash so that you can use sam-ba again, I am sure there is a way to do that with your board but read the users guide first.
Please do not close this person out for asking about using a software tool. There are countless numbers of how do I use my iphone simulator or why is my android simulator slower than my iphone simulator questions that dont get touched. this question is as relevant as any of the programming questions about how to use gcc or some web thing or how to start up my phone simulator or java vm. I wouldnt want to have to start a campaign to close all of the gcc or iphone tagged questions because they are not programming questions.
I think my question was misunderstood. The GUI window which I have posted is NOT what I get. I just posted it to say that I am not getting such a window at all. That window pops up only when I select 'no board'. When I select SAM7S256-EK there is no response. No window opens. As given in your blog sam7stuff.blogspot.com, I downloaded SAM-BA. The onlydifference as u have posted and in the response also id that u are using a 'h' board.
Right now I am using a custom made SAMBA alternative from this website,
http://claymore.engineer.gvsu.edu/~steriana/Software/
It is also a python based boot loader. It is command line though.
I would love to use the SAM-BA GUI. I am sure that the board is OK and samba is communicating with the board b'cos if I select any other board type other than ARM7S256-EK option it is giving me 'communication failure'.
If you have any suggestions please do let me know. Also many thanks for backing me up. I had some real good insights from this forum about embedded field and I felt it is a good place to discuss embedded programming doubts and never thought of 'programming' or 'non-programming' b'cos for SAM-BA user guide itself talks a lot about customizing the SAM-BA for a custom made board involving TCL scripts but I couldnot get hold of the concepts. So I thought someone would have had the same problem and would have found a TCL or C 'programming' solutions in this forum.
Thank you.
I'm Making a small on-line clock (both for fun and to learn a bit more of php and javascript) started it because i actualy need an alarm clock and this would be easier than buying one (don't ask)
Now i wanted to know one thing, i know it's impossible to turn on/off you're computer from a browser, but a friend asked me if i could do him a small addon/program that would fetch the alarm time he added there, and would turn his computer on so it would let if wake up
I know turning on must be pretty much impossible, but turning on from sleep/hibernate maybe?
Anyone knows any api to do this? Windows or mac, or cross platform.
Just for curiosity the alarm clock is here http://www.my-clock.net
Edit:
On the wiki page, wake-on-lan says it requires to turn the bios power to the network-board, is there any way arround this? Or are todays computers already ready for this kind of protocol?
There could be two solutions:
Use Wake-on-LAN as was suggested. But you must have another machine up on that LAN, it doesn't work over the Internet itself. So it goes like You -> [Internet] -> Waker -> Your friend.
You can set his RTC wakeup alarm over the Internet while his machine is still up and running. Then his computer will wake at the specified time.
Both would work even if the computer is completely powered-off.
Once a OS goes in hibernate/sleep the only way to bring it up is through some kind of kernel level hardware driver event. for example pressing power button or opening the lid of the system etc.
IMO it would be bit complex to model the functionality within an application, as application is dependent on OS level services, that are not available in sleep/hibernate mode.
I don't know a lot about how it works, but it sounds like you need Wake-on-LAN
Wake on LAN (WOL, sometimes WoL) is an Ethernet computer networking standard that allows a computer to be turned on or woken up remotely by a network message.
Your best bet may be Wake-on-LAN
As people have pointed out, Wake-On-Lan is one possibility. But there's another one that might suit your need. Most BIOS'es today already provide an option to turn your computer on at a given time. If your goal is simply to turn your computer into an alarm clock, this should do the trick.
I would like to be able to programmatically emulate a shutter button press on my Casio Exilim EX-F1 digital camera.
It comes with a USB tethered remote control that can emulate a shutter press, so I would think there is a way to emulate that from a PC.
I've looked and can't find any libraries or anything for controlling this camera.
Anybody have any ideas? How about a way to "sniff" the USB being sent from the remote (I can't imagine that's easy).
Ok although it might be out-of-the-box thinking the easiest solution I can think of, without having the patent documentation + technical specs in-front of me (that is the normal route people use to do this sort of thing) you could always use Lego Mindstorm robotics.
Edit: Anyways besides the Lego, which would be my course of action, I mentioned, the hard-core way is to use the Spec sheets, you can normally get them off the website, but then your basically into driver programming. If you find that prospect attractive in anyway this link will give you some ideas for doing it on Windows.
In case anyone finds this question, Casio finally released an official way to do this with the free EX-F1 Controller software (with special firmware included):
http://support.casio.com/download.php?rgn=5&cid=001&pid=573
It has its limitations but it makes more possible for sure.
There's a non-official API to control the Casio EX-F1. It's a reverse enginyering free (as in freedom) product.
http://code.google.com/p/exf1ctrl/