Show Posts
Pages: 1 ... 20 21 [22] 23 24 ... 80
316  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.
317  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.

318  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.
319  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.
320  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.
321  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.
322  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.
323  Using Arduino / Storage / Re: How would I use this SD card breakout/adapter? on: October 13, 2013, 04:59:06 am
SCK is CLK.
324  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.
325  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.
326  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.
327  Using Arduino / Project Guidance / Re: digital pot on: October 12, 2013, 05:04:29 pm
firstly you need to keep track of the number you have between 0-255, and every time that you detect the button you increment the variable and then send that to the pot. The serial comms are SPI, which is the same as you would use for a 595 shift register, of which there are LOTS of examples usually associated with setting LED patterns. The application may be different, but the technique is exactly the same. The circuits will also be identical (clock, data and enable/latch digital pins for the interface).

Here's some code that I wrote a long time ago to set LEDs
Code:
//The 74HC595 using a protocol called SPI (for more details http://www.arduino.cc/en/Tutorial/ShiftOut)
//Which has three pins
#define  DATA_PIN  10   
#define  CLOCK_PIN  9
#define  LATCH_PIN  8

void setup()
{
  // We set the three control pins to outputs
  pinMode(DATA_PIN, OUTPUT);
  pinMode(CLOCK_PIN, OUTPUT); 
  pinMode(LATCH_PIN, OUTPUT); 
}

void updateLEDs(byte value, boolean bReverse, int nPause)
// Handle the interface to the 74HC595 to write the 8 bits of the byte 
// Optionally invert the bit string and then delay at the end
{
  if (bReverse) value = ~value;

  digitalWrite(LATCH_PIN, LOW);  //Pulls the chips latch low
  shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, value); //Shifts out the 8 bits to the shift register
  digitalWrite(LATCH_PIN, HIGH);   //Pulls the latch high displaying the data
 
  if (nPause != 0) delay(nPause);
}
328  Using Arduino / Project Guidance / Re: digital pot on: October 12, 2013, 01:11:37 am
It can be done, just as you described.

Without any details of what the hardware is or how you have connected it, etc, you are probably not going to get much help.  If you have already written code then post that too.
329  Using Arduino / Programming Questions / Re: Is there any way to "delay()" (or equivalent) within an interrupt? on: October 11, 2013, 06:29:51 pm
Hard to give advice without any idea of the application.

What you can do is set a flag/status from the interrupt routine to signal that the interrupt has occurred. Then somewhere else (like loop()) count up time until the required delay has happened. You should always make your interrupt routines as fast as possible, so any form of lingering in the ISR is a generally bad idea.
330  Using Arduino / LEDs and Multiplexing / Re: Led Matrix 8x8 x5 max7219 on: October 11, 2013, 04:52:52 pm
Simplistically, you could take each of your animations and put them in a separate function (animation1, animation2, etc). In the main loop you then check if a button is pressed and if so, increment a variable with wraparound. The correct animation is then run through a case statement. Something like this:
Code:
void animation0()
{
// stuff in here
}

void animation1()
{
}
// etc for as many animations as you want, lets say MAX_ANIMATION

void loop()
{
  static int anim = 0;

  switch (anim)
  {
  case 0:   animation0();  break;
  case 1:  animation1(); break;
// etc
  default: anim = 0;  // in case things go crazy :-)
  }

  // check if the button is pressed
  if (buttonpressed)  // substitute your code here
    anim = (anim + 1) % MAX_ANIMATION;
}

I would encourage you to do this step as it will create a basic flow. However, what you will quickly find is that the animations changing is hard because the button is only detected once an animation is over (you are use the delay() function in the animation function), whereas as a user you would expect to have the change happen as soon as you press the button.

In order for the software to do what you expect you will need to use techniques shown in the BlinkWithoutDelay example, checking the timer rather than calling delay(). At that point you may find it more convenient to have the animation bit patterns as arrays because you need to remember where you were in the animation (ie, the array index of the last pattern sequence) every time the animation function is called. You set up the bit pattern array like this:
Code:
uint8_8 pattern0 [][8] =
{
  { B00010000,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000,B00010000 },
  { B00010000,B00010000,B00001000,B00000100,B00000010,B00000100,B00001000,B00010000 },
// etc - you get the idea
}

Then your code changes to be one animation routine called with a different pattern array (ie, the code becomes general and the data tells it what to do). This makes managing your code much easier and changing patterns becomes easier as well.

Hopefully this is enough of an explanation to get you going.
Pages: 1 ... 20 21 [22] 23 24 ... 80