Like described in the title i want to turn on a LED for a period of time.
The time must be able to be interrupted. For example triggered by a button or touch display. I tought of using a timer with the interrupt but i have no idea how to realize it.
Does someone have example code for this problem? Would be nice.
Related
Im trying to write code so that I can control the LED strip. All I want to start with is to learn how to turn the first 1 or 2 LEDs a certain colour. I have no idea how to actually implement this. Particularly unsure about how to output a data pulse from a GPIO pin.
I think i should use PWM to create the data pulse but im struggling to get started. I know that I need to send 24 bits to control the LED strip but not sure how this is possible using a GPIO pin. Any advice on where I can look to get started would be really appreciated. There seems to be lots of resources for this on the Arduino but struggling to find much for the MSP430.
I'm trying to calculate the time the button was pressed with the STM32F407 Discovery. Frequency can be any value for now. How do I calculate time?
What I am trying to do is; To enable the microcontroller to perform different operations according to different pressing times with two buttons (For example, changing the flashing times of the led). While doing this, I want to press one button for 1 second and the other button for 4 seconds (short - long press). Let the led continue its operation by not leaving the loop during the time I press it. Let it do whatever it takes when you release the button.
Help.
I am trying to add countdown timer into an AngularJS app (a small quiz)
That part is probably easy enough.. The catch is that I want a progress bar at the bottom of the page to sync up with the countdown timer (So the bar either increases or decreases as the timer runs out)
Not looking for a complete answer, just someone to point me in the right direction of to how to approach the task as I feel a bit clueless.
Once again, thank you in advance, kind Angular wizards!
This is more of a conceptual/implementation question, rather than a specific language problem.
Does anybody have any insight into cursor movement recording?
It's very easy to get a cursor's current position, but how would you go about recording the path followed by the cursor?
(To the degree of detail where it could be plotted graphically without ambiguity as to the path taken)
I imagine you could record the cursor's current position repeatedly after a small duration, logging it all to make a list of chronologically visited coordinates,
but I'm not sure how frequent (or feasible) the recording should take place; every 10 ms?
I've not even encountered a method of sleeping for such short durations to the nescessary precision!
I'm concerned also about the performance of the sleeping and recording during intense CPU usage; when the user is using the mouse to interact with intensive software.
I'm not even entirely sure where the cursor is really moving.
If I sweep my cursor across the screen, has the computer (somewhere internally) acknowledged that I crossed all those pixels,
or has my mouse really told it "I was there, now I'm over here, now I'm there".
I do also seek a method of differentiating between fast and slow movement, but for now, I can just observe the plot spacing on a graph of the visited coordinates.
Does anybody have any insight into this?
Any potential pitfalls; are my concerns legitimate?
Am I going the wrong way about this?
(As is observable, I really need some guidance in the matter)
Thanks!
It's far easier to log the mouse movements within the same application - just log something on every WM_MOUSEMOVE message. You will get a message periodically updating the mouse pointer location. You will not get a WM_MOUSEMOVE message for every pixel the mouse crosses, but it will jump depending on how fast you move the mouse and how busy the system is.
Logging mouse movements in some other application is going to be slightly more involved. If you have written both the logger and the application being logged, then you can handle WM_MOUSEMOVE in the application being logged, and send a corresponding message to your logger application. Your choice of IPC; a simple SendMessage() might be sufficient.
Logging mouse movements across the whole system is a totally different problem. You may have to hook in at somewhere closer to the driver level.
I just thought of another approach - the CBT (Computer-Based Training) hooks are designed to provide exactly this sort of information across applications. I've never used these though, so you'll have to do more investigation.
I've been playing around with Silverlight 5 and started putting together a little game. It's nothing special and it's purely to just play around.
If you look at the link below you'll notice that it's lagging a bit.
Link(Just use the arrow keys): http://www.netauto.co.za/WIP/GameTest.html
Basically I'm using a Storyboard to scroll the road and move the cars on the screen with every tick. At first I used the CompositionTarget.Rendering, but I was having the same problem. So I thought I'll try a Storyboard, but it made no difference.
There is a second timer that adds a vehicle in a random lane with every tick. They get removed once they go off screen. Disabling this timer makes no difference.
CPU usage is almost none. Also tried it on another PC and it was exactly the same.
I would post some code, but there's quite a bit of it and as I'm just fooling around it's a bit of a mess 0.o
Any ideas on how I can move the objects around without that lag?
I'm using Silverlight 5.
Thank you
You can try to use BitmapCache on the scrolling road and cars, if you are not already. This can cut down on the traffic to the GPU.
More links: One, Two.