Show Posts
Pages: 1 ... 1887 1888 [1889] 1890 1891 ... 3339
28321  Using Arduino / Programming Questions / Re: Programming timers questions on: April 20, 2012, 07:35:16 pm
Is that the most efficient way or could I do anything else?
Yes. It is the simplest solution, therefore the most efficient. And, yes, you can do something else. Why you would want to, though, is a mystery.
28322  Using Arduino / Programming Questions / Re: opencv and arduino on: April 20, 2012, 07:00:34 pm
i need the serial communication code that can send data from arduino to visual studio thx you !
How about some code to send serial data to Paint or Notepad? It makes as much sense to send serial data to Paint or Notepad as it does to send serial data to Visual Studio.

Visual Studio is an application development application. It does not read anything from the serial port.

It allows you to write application in a number of languages (C, C++, C#, etc.) that can read (some more easily than others) from the serial port.

All you need on the Arduino is Serial.print().
28323  Using Arduino / Programming Questions / Re: Push button switch program on: April 20, 2012, 06:53:04 pm
Talk about overkill. You don't need interrupts to read a single button press.

OP, the problem with your code is the way you assign a new value to initial_state. You should have this in loop:
int ledState = LOW;
void loop()
  current_state = digitalRead(2);
  if (current_state != initial_state)
    // A transition occurred
    if(current_state == HIGH)
       // to pressed
       ledState = !ledState;
       digitalWrite(ledpin, ledState);
  initial_state = current_state;
  delay(20); // debounce
28324  Using Arduino / Programming Questions / Re: HTML action on an arduino variable on: April 20, 2012, 09:35:09 am
but how do i see it in Arduino?
You have a submit button, right? That causes a GET request to be sent to the server. Capture that get request (I believe the library does this for you). Then, parse the get request. The request for the page initially might look like "GET /temp.htm HTTP 1.0". After the submit, the request might look like "GET /temp.htm?Temp%20+ HTTP 1.0" or "GET /temp.htm?Temp%20- HTTP 1.0". You'll have to determine what the exact request looks like, and pick out the part that says up or down. The strtok() function is interesting.
28325  Using Arduino / Programming Questions / Re: arduino adalight code change on: April 20, 2012, 09:29:57 am
the leds have a fault since the red and green are crossed, meaning when there should be a red light, i get red and the other way around.
This is a fault?
28326  Using Arduino / Programming Questions / Re: How to determine trending of values.. on: April 20, 2012, 09:28:35 am
Determining if one value is higher or lower that another value is easy.

Determining if the average of a number of values is higher or lower than a previous average is not much more difficult.

How often does the value change? What is providing this value? Over what time are you interested in the trend? Or, is it instantaneous changes that are of interest?
28327  Using Arduino / Programming Questions / Re: Question about on/off led with (RFID module) on: April 20, 2012, 09:24:51 am
but i cannot close the led by passing the card for the second time.
Why can't you?

       if(serNum[0] == 163 )  {
                          cardState = !cardState;
Where cardState is a boolean, initialized to false.
28328  Using Arduino / Interfacing w/ Software on the Computer / Re: pH/ORP stamp Atlas scientific on: April 19, 2012, 05:15:22 pm
Is there some part of the error message(s) that you don't understand. Ditch the stupid String class!
28329  Using Arduino / Programming Questions / Re: Keypad Read on: April 19, 2012, 04:55:16 pm
Your test for a key is incorrect. It should be:
if(key != NO_LEY)

You really should adapt one of the examples, all of which use a keypadEvent callback to handle key presses.
28330  Using Arduino / Programming Questions / Re: error inside Serial.<init>() what do I do? on: April 19, 2012, 04:47:55 pm
@Masrek080 - that is a Processing sketch.

You are telling the software to connect to the 2nd serial port in the list. Is that the one that your Arduino is connected to? What is loaded on the Arduino?
28331  Using Arduino / Programming Questions / Re: Basic programing and start up for stepper sketch on: April 19, 2012, 04:42:45 pm
It looks to me like you need to use pins 9, 11, 12, and 13 for you Stepper instance, but what order they should be in, I couldn't tell you.
28332  Using Arduino / Programming Questions / Re: RSSI Data dBm on: April 19, 2012, 04:36:01 pm
Am I not getting the XBee in AT Command mode when I write +++?
Yes, but if commands don't arrive in a timely fashion, it exits command mode. As I recall, "timely fashion" means less than a second between commands. Your 1 second delay shoots that opportunity all to hell.
28333  Using Arduino / Programming Questions / Re: RSSI Data dBm on: April 19, 2012, 02:26:35 pm
You know that you have to put the XBee in command mode, first, right? Then, when you get the OK, you can send it other AT commands.
28334  Using Arduino / Programming Questions / Re: Basic programing and start up for stepper sketch on: April 19, 2012, 02:24:01 pm
For sure, the motor shield does not use pin 1. That is a serial port pin.
28335  Using Arduino / Programming Questions / Re: Arduino Locks up when using PROGMEM.... on: April 19, 2012, 02:21:16 pm
What do your debug Serial.print()s tell you? Oh, wait, you don't have any. Time to remedy that.
Pages: 1 ... 1887 1888 [1889] 1890 1891 ... 3339