Show Posts
Pages: 1 ... 16 17 [18] 19 20 ... 235
256  Using Arduino / Programming Questions / Re: How can I program loop? on: March 22, 2014, 08:44:33 am
I think that the first thing that you should do is to learn about and use arrays.  For example, this code
Code:
const byte greenLeds[] = {22, 24, 26, 28, 30, 32, 34, 36, 38};
const byte redLeds[] = {23, 25, 27, 29, 31, 33, 35, 37, 39};

void setup()
{
  for (int pin = 0; pin < 9; pin++)
  {
    pinMode(greenLeds[pin], OUTPUT);
    pinMode(redLeds[pin + 1], OUTPUT);
  }
}

void loop()
{
}
sets up all the LED pins as outputs.  Notice how much neater and smaller the code is than yours.  The structure will pay dividends later, trust me.

As you can see from the code in my setup() function you can refer to the LED pins by the array name and iarray index number which makes turning them on in sequence  much easier, which I think is what you want to do.

So, to turn on the third red LED for example you do
Code:
digitalWrite(redLeds[2], HIGH);
Note how the array index starts at 0 not 1, so the third LED is index number 2.
257  Using Arduino / Programming Questions / Re: Effect of switch bounce on external interrupt ? on: March 22, 2014, 03:41:28 am
Quote
The interrupt signal should arrive a short time after the relay is energised. I don't want to poll for the rising signal while running the counting / timer function at the same time because I want the fastest response possible when that rising signal comes, hence my decision to use an interrupt.
Can you quantify any of these timings, for instance, how fast is fast, how short is a short time in your application ?
258  Using Arduino / Programming Questions / Re: DHT22 constant timeout error. on: March 22, 2014, 02:28:33 am
Just to be sure that you did not comment out too much or alter anything accidentally can you please post the code that you are using and confirmation of exactly how the sensor is wired.

Did you see this note on the Playground page ?
Quote
There have been reports that some sensors have pin 3 and 4 reversed, probably as a quality control/manufacturing issue. If you have issues, consider grounding both pins 3 and 4.
259  Using Arduino / Programming Questions / Re: simple sketch for switch and relay on: March 22, 2014, 02:20:15 am
Yes, strange as it may seem at first, the rollover of millis() to zero does not affect the calculation if it is done as a subtraction of the start time from the current time.
260  Using Arduino / Programming Questions / Re: C or sketches? on: March 21, 2014, 05:04:06 pm
The programming language used by the Arduino IDE is C++ with extensions for the Arduino hardware, so your question is irrelevant.
261  Using Arduino / Programming Questions / Re: arduino read data from mysql on: March 21, 2014, 05:46:50 am
Do you get anything back from the server ?
Code:
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
262  Using Arduino / Programming Questions / Re: arduino read data from mysql on: March 21, 2014, 03:44:28 am
Post the code of what you currently have working.
Please read the advice on posting code in the forum stickies.
263  Using Arduino / Programming Questions / Re: arduino read data from mysql on: March 21, 2014, 03:08:44 am
As a start, if you use the Ethernet client on the Arduino to send requests to the server you will get a response which you can display in the Arduino Serial monitor window. 

Have you got that far ?
264  Using Arduino / Programming Questions / Re: SIM900 Shield SoftwareSerial Problem on: March 21, 2014, 02:25:55 am
Please post the program that you are using. 
Is SoftwareSerial actually using pins 7 and 8 ?
Do you need to do anything, set a jumper maybe, to tell the board to use SoftwareSerial instead of hardware serial ?
265  Using Arduino / Programming Questions / Re: arduino read data from mysql on: March 21, 2014, 02:16:29 am
Quote
can i type sql code to arduino ide ?
You can use the Arduino to send SQL commands over Ethernet just like any other HTTP data.
266  Using Arduino / Programming Questions / Re: continuous note on midi on: March 21, 2014, 02:13:23 am
yes i know how read the button and i know how send note on command.
but if i send every cycle a note on command the note on my synth sound like bip...bip....bip... and not a continuos biiip.
sorry for my explanation.
That has clarified the problem and Mike has given you the solution.  You may find the StateChangeDetection example in the IDE helpful in implementing that solution.
267  Using Arduino / Programming Questions / Re: continuous note on midi on: March 20, 2014, 01:38:19 pm
Read the button. 
When it is pressed send the midi note on code. 
Keep reading the button until it is released then send the midi note off code.

Do you know how to read the state of a button ?  Examples are available in the IDE.
Do you know how to send the midi note commands ?  You have found code that does this.
268  Using Arduino / Programming Questions / Re: Arduino Mega 2560 with some C - not reading analogue pins on: March 20, 2014, 10:45:29 am
I am a moron, fogot to set pinmode, which can be done in C and wiring
But http://arduino.cc/en/Tutorial/DigitalPins#.UysOfah_s1I says
Quote
Arduino (Atmega) pins default to inputs, so they don't need to be explicitly declared as inputs with pinMode() when you're using them as inputs
269  Using Arduino / Programming Questions / Re: Stopwatch class on: March 20, 2014, 03:56:27 am
Hi
I have installed the library at
C:\Program Files (x86)\Arduino\libraries\StopWatch

Please tell me the changes I have to make .

Kind Regards
Paul has given you the answer and you have now got your program working, but now you will see why I asked exactly where the library was installed.
270  Using Arduino / Programming Questions / Re: Stopwatch class on: March 19, 2014, 01:40:41 pm
Where (exactly) have you installed the StopWatch library ?
Pages: 1 ... 16 17 [18] 19 20 ... 235