Show Posts
Pages: 1 ... 20 21 [22] 23 24 ... 80
316  Using Arduino / Programming Questions / Re: Help pulling data out of a seperate void function and turning it into variables. on: October 19, 2013, 01:40:26 pm
Your question is not that clear and your code does not seem to be complete.

All the distance values are stored in an array called cm. so cm[0] is the first, cm[1] is the second, etc. The cm array declared with global scope which is ok given your intended use.
317  Using Arduino / Project Guidance / Re: Programming Midi Shield for Arduino on: October 18, 2013, 05:48:30 pm
Please use code tags (the # button on the post screen) around your code. It makes it easier to read. You can edit you previous post to correct this.

I am guessing from your question that you don't understand the way MIDI notes work. You can search for this on the internet, but this link should get you started http://www.music-software-development.com/midi-tutorial.html

Once you have read that, you will understand what this does
Code:
  if(button(BUTTON1) || button(BUTTON2) || button(BUTTON3))
  {
   
    noteOn(0x95,0x3C,0x45);
    digitalWrite(STAT2,LOW);
    while(button(BUTTON1) || button(BUTTON2) || button(BUTTON3));
  }

The same note is sent no matter which button is pressed. This is what you want to change with the note of your choice to something more like this:
Code:
  if(button(BUTTON1)
  {
    noteOn(0x95,0x3C,0x45);
    digitalWrite(STAT2,LOW);
  }
   if(button(BUTTON2)
  {
    noteOn(<something else>);
    digitalWrite(STAT2,LOW);
  }   
  if(button(BUTTON3)
  {
    noteOn(<something else again>);
    digitalWrite(STAT2,LOW);
  }
while(button(BUTTON1) || button(BUTTON2) || button(BUTTON3));

btw, I am really not in favour of the while statement locking out anything from happening while one of the button is pressed. This may be ok in test code but it is really bad practice and you should try and get used to working in a more asynchronous manner (look up finite state machines and also get familiar with the techniques used in the BlinkWithoutDelay example).
318  Using Arduino / Project Guidance / Re: Programming Midi Shield for Arduino on: October 18, 2013, 03:22:26 am
What have you got so far (code and circuits)?
319  Using Arduino / Programming Questions / Re: Is there any way to "delay()" (or equivalent) within an interrupt? on: October 17, 2013, 03:42:15 am
Code:
    STATE = digitalRead(2);
    if (STATE == 0){
      StopforHuman(); // Ouroboros ;)
    }

is the same as

Code:
while (digitalRead(2) == 0)
  ; // do nothing

with no recursion.

You do know that the processor will appear to just stop and actually do nothing while this loop is running?
320  Using Arduino / LEDs and Multiplexing / Re: Led Matrix 8x8 x5 max7219 on: October 16, 2013, 04:43:24 pm
Don't forget that you can always attach a file to tthe post, it does not have to be text in the post itself. Look at the additional options menu at the bottom of the post edit text box.
321  Using Arduino / Sensors / Re: MQ7 Sensor Module Analog Output on: October 15, 2013, 09:24:34 pm
Have you googled "MQ7 Arduino" - I am sure you are not the first. Also it is worthwhile getting the datasheet for the MQ7 - try "MQ7 datasheet pdf" in google.

You can only do a linear interpolation if the sensor is linear. The response curve will be on the datasheet information. It looks pretty linear and they also give good ideas on the responsiveness, etc

Lowest analog value (0) will be the lowest value for the voltage and the highest (1023) will be the highest value. Not sure where you get 50 and 170.

Also the sensor is for CO, not CO2 (my mistake), so soft drink will not work.

322  Using Arduino / Sensors / Re: MQ7 Sensor Module Analog Output on: October 15, 2013, 08:14:37 pm
The gas insoft drinks is C02, so if you can capture that in an upside down jar then you are sure that the concentration is very high.
323  Using Arduino / Programming Questions / Re: uno to pro mini tx rx on: October 14, 2013, 03:17:47 am
If you are using on a breadboard, connect one end of the wire to ground and touch the reset pin with the other end to reset it. Same thing as a switch.
324  Using Arduino / Programming Questions / Re: uno to pro mini tx rx on: October 14, 2013, 02:28:35 am
Just noticed that this is a pro MICRO. Sparkfun has a similar model https://www.sparkfun.com/products/11098 with schematic.

From the schematic it looks like the reset pin is permanently pulled high (ie, not reset). You should be able to add an external momentary on switch to pull the pin to ground and cause a reset. Then follow as per my first suggestion.
325  Using Arduino / Programming Questions / Re: uno to pro mini tx rx on: October 14, 2013, 01:59:43 am
Who did you get this from and/or do you or they have a schematic for this? You can see how the reset works on there.
326  Using Arduino / Programming Questions / Re: uno to pro mini tx rx on: October 14, 2013, 01:31:46 am
You probably need to press the reset button on the mini pro to get the download started.

Start the compile/download. When the Rx light starts to flash, press the reset button. This makes the bootloader start.
327  Using Arduino / Storage / Re: How would I use this SD card breakout/adapter? on: October 13, 2013, 04:59:06 am
SCK is CLK.
328  Using Arduino / Project Guidance / Re: Counting Number of times a button is pushed on: October 12, 2013, 10:56:49 pm
Yes there is. Lots of examples if you google for it.
329  Using Arduino / Programming Questions / Re: Serial only works after upload on: October 12, 2013, 10:55:38 pm
OP said it was an Uno in his post.
330  Using Arduino / Programming Questions / Re: Serial only works after upload on: October 12, 2013, 10:49:59 pm
There could be a difference between the sketch not running and just not getting serial output. Try flashing a led on and off every second and see if that is going even when you don't get serial output.
Pages: 1 ... 20 21 [22] 23 24 ... 80