Show Posts
Pages: 1 ... 27 28 [29] 30 31 ... 86
421  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.
422  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.
423  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.
424  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.
425  Using Arduino / Storage / Re: How would I use this SD card breakout/adapter? on: October 13, 2013, 04:59:06 am
SCK is CLK.
426  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.
427  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.
428  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.
429  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);
}
430  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.
431  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.
432  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.
433  Using Arduino / Programming Questions / Re: 24X6 Led Matrix works BUT I want to add animations also. Need help!! on: October 11, 2013, 10:31:48 am
Ok then, good luck with your project.
434  Using Arduino / Storage / Re: Reading/writing struct to sd card on: October 11, 2013, 04:31:08 am
There is no = as per the error message. Think about what the function is doing. It is filling the memory from the SD card, so why are you needing to assign anything? Also, look at the function documentation to see what the return value  is.  People who write libraries document stuff so you can us their libraries more easily, but you do need to make the effort to read up on it to make sure you are using it properly.
435  Using Arduino / Storage / Re: Reading/writing struct to sd card on: October 11, 2013, 02:08:57 am
Most good libraries have a block read as well, to match the block write. In this case you will need to use a loop to read all the data in one byte at a time. Set a uint8_t pointer to the address of the data/struct and then for each byte you read, assign it to the 'pointed' location and increment the pointer, repeat.
Pages: 1 ... 27 28 [29] 30 31 ... 86