Show Posts
Pages: 1 ... 79 80 [81]
1201  Forum 2005-2010 (read only) / Bar Sport / Re: timmer problem - please HELP LIFE AND DEATH SITUAT on: October 07, 2010, 09:26:22 am
Quote
The limit on millis() is roughly 49 days.

The roll over after 49 days won't affect you as long as you don't try measure delays that are longer than those 49 days. You just need to write your code properly. Use this:

Code:
unsigned long startime;
unsigned long endtime;
...
if (endtime - starttime > delay)  // Good code

The subtraction will give you always the correct difference even if endtime did roll over and starttime didn't. Don't forget to declare them as unsigned long.

In contrast, this will fail if endtime rolled over but starttime + delay didn't:
Code:
if (endtime > starttime + delay) // Bad code

Korman
1202  Forum 2005-2010 (read only) / Bar Sport / Re: timmer problem - please HELP LIFE AND DEATH SITUAT on: October 07, 2010, 09:11:47 am
Sometimes question come up where things might really get dangerous: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286189148

About your question: yes.

You do something like:
Code:
loop () {
// Static so that the value doesn't get lost between calls of loop
static unsigned long starttime;

....
if ( stopwatch should be started) {
// Here we start the watch
starttime = millis();
....
}
else if ( stopwatch should be ended) {
// Here we stop it
unsigned long laptime = millis() - starttime;
// Go on and make seconds, hours or whatever out of it and display laptime
...
}
}

Korman
1203  Forum 2005-2010 (read only) / Bar Sport / Re: timmer problem - please HELP LIFE AND DEATH SITUAT on: October 07, 2010, 08:59:02 am
I have done work for medical equipment, power-stations and rail-road systems. And even a controller for a big engine moving sharp thingies at high speed is no fun when it runs amok.

So yes, these situations can arise even if it isn't a pacemaker or a robotic peace-maker.

Korman
1204  Forum 2005-2010 (read only) / Bar Sport / Re: timmer problem - please HELP LIFE AND DEATH SITUAT on: October 07, 2010, 08:46:21 am
If this is used in an environment where life and death are at stake, stop messing around and have it done by someone with a clue. If it isn't, it was a very weak joke.

As to your problem, you need to create a primitive state machine:

If timer is not running, button was release before and button is pressed now --> remember start time
If timer is running, button was release before and button is pressed now  --> save end time, calculate difference and display it
If button is release --> remember that the button is released so the next time you see the button is pressed, you need to take the button press actions.
If button was pressed before and is still pressed --> do nothing.

Depending on your type of button you might need some debouncing of the button on top of this. Easiest in your case is to add a delay(100) at the end of the actions taken when a button press was detected.

The implementation details are left to the student.

Korman
1205  Forum 2005-2010 (read only) / Bar Sport / LW receiver module for Navtex on: October 05, 2010, 02:30:49 am
Does anyone out there know, if there's a Navtex receiver (518kHz and 490kHz) module out there. I'm looking for something small that I can connect to an Arduino.

Alternatively, does someone have a simple LW receiver circuit that would allow to receive those two frequencies with sufficient quality? Most long and medium wave AM receiver modules seem to just jump over those frequencies, they end somewhere around 250kHZ and restart at 520kHz.

The message decoding is less of a problem, I'm more interested in having the RF part done with a working solution I don't need to debug - I'm a software guy after all.

Korman
1206  Forum 2005-2010 (read only) / Bar Sport / Re: Getting started in computer graphics programming on: October 02, 2010, 01:48:35 am
What level and type of graphic programming do you want to do? Are you interested in setting pixels across a bitmap and do your own line algorithm, or is a graphic library like GTK++ ok, which provides most primitives already (it still allows to do your pixel manipulation). Or is it more an object oriented approach like librsvg or opengl, where you define geometric objects and the actual scaling and rendering is left to the engine. Or are you more into photo and video processing, where you want to fool around with filtering and enhancement algorithms and visual perception? Or are you more into the interactive graphic aspect (in plain text: games)? And not to forget data visualisation and mathematical graphics, those open yet another filed of opportunities with very good packages to play around with.

Questions over questions and for all of them there are good and free solutions to get you going quite quickly. You just need to know what you want.

Korman
1207  Forum 2005-2010 (read only) / Bar Sport / Re: WTF? Chip ID markings sanded off? on: September 26, 2010, 04:27:53 am
Quote
Road rash from the box of chips falling off the back of the truck?

That's a good one.

Korman
1208  Forum 2005-2010 (read only) / Bar Sport / Re: Arduino UNO on: September 28, 2010, 07:08:08 am
Only if the unpacking is done by a good-looking nude 20-year old using a chainsaw. The choice of chainsaw brand and whether boy or girl we leave to your creativity.

Korman
1209  Forum 2005-2010 (read only) / Bar Sport / Re: Did you see this? Dinner is ready.... on: September 25, 2010, 02:55:26 am
Hurrah! They get rid of the FTDI chip and add a chip that can appear as a HID. That alone is worth upgrading.

Korman
1210  Forum 2005-2010 (read only) / Bar Sport / Re: Keyboard function on: September 23, 2010, 07:03:22 am
Hello,

you sound very confused.

If your car has an Arduino mounted and you control it remotely from your PC, why should the Arduino provide you with keyboard codes for a device it doesn't have? That sounds more like you should look up in the documentation of your PC-Programming platform and not on the Arduino side how to handle keyboard input.

As a general note, you should first clean make at least a rough concept about how your system is going to work. Get rid of all the "Magic happens here" parts. My guess is you're going to need about 4 ports in your software:

[1] On your PC something to handle the key commands you issue.
[2] On your PC something to send the commands read in Step 1 to the Arduino
[3] On the Arduino something to handle the received commands from the PC created in Step 2
[4] On the Arduino something to execute the received commands from step 3 on the car hardware to change direction or speed.

Each of these modules can be refined and tested individually, usually quite independent of the rest. In Step [1] you will work only on your PC and work on the user interface, Step [4] will deal with your car hardware and how to attach it to the Arduino, in Steps [2] and [3] you will mess around with the communication between the PC and the Arduino.

Good luck.

Korman
1211  Forum 2005-2010 (read only) / Bar Sport / Re: Systems and Networking Project Suggestions Please on: September 22, 2010, 10:57:26 am
It would help if you gave some hints about what scope and direction you want to go. With the little hints you have, here are a few suggestions:

Armed Autonomous Hovercraft.
Remote zapper with BS detector.
Football with integrated wireless speedometer and accelerometer.


Korman
1212  Forum 2005-2010 (read only) / Uno Punto Zero / Re: More c# & VB.net source code, together with scetch on: September 28, 2010, 09:18:36 am
Sorry about that, I missed it. I though there are also servo controls available for Fimata. I must have missed that.

Korman
1213  Forum 2005-2010 (read only) / Uno Punto Zero / Re: More c# & VB.net source code, together with scetch on: September 28, 2010, 03:41:39 am
You may want to look into the Firmata project. It's more about remote controlling stuff attached to an Arduino from a PC.

Korman
1214  Forum 2005-2010 (read only) / Uno Punto Zero / Re: Confused by the variants... on: November 07, 2010, 04:02:15 pm
Get an Arduino Pro Mini (either 5V or 3.3V) solder a few pins into the holes on the side and put it on a breadboard. Also solder a few pins upwards on them and plug in the usual FTDI USB-to-TTL cable or converter - just make sure you have the the correct version (3.3V or 5V depending on your Arduino).

That's it. This setup is usually 1 or 2 € more expensive than just getting a ready to use Arduino, but if you need a second one an can live with just one USB connector, you'll end up a little cheaper.

Korman
Pages: 1 ... 79 80 [81]