Loading...
  Show Posts
Pages: 1 ... 57 58 [59] 60 61 ... 68
871  Using Arduino / Project Guidance / Re: Driving lots of 7-segment displays. (Or possibly 14-segment) on: December 03, 2011, 12:48:04 am
Try checking out the MAX7221 chip. It's pretty expensive ($10) but you don't need to wire up resistors for the LEDs (save one for setting current) and you can just send it a string like "09221" over SPI (three pins) and it'll display them (ie a 7segment decoder). It can handle up to 8 digits (and you can string them up without using any extra arduino pins). It'll also do a LED Matrix if you like those.

The only other reasonable option from a string of breadboards is to have a custom PCB. And if you go with the breadboard route, the wiring will get pretty intense. Then again, custom PCBs are scary and somewhat expensive.

Also, you really don't need to worry about update speed; I doubt anything you'll have will be slower than the PC Serial connection, and you can only really perceive updates more than about 50ms apart (I believe that's 80000 clock cycles).
872  Using Arduino / Installation & Troubleshooting / Re: I think deleting WProgram.h was a bad idea on: December 03, 2011, 12:33:05 am
like
Code:
#if ARDUINO >= 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif

?
873  Using Arduino / Programming Questions / Re: How do I make an I2C-slave Arduino just wait? on: December 03, 2011, 12:17:44 am
Code:
bool valuerequested = false; //global variable

void onRequest() {//not sure how this syntax is...
   valuerequested = true;
}

void setup() {
  //Stuff
}

void loop() {
  //Read sensors
  while (!valuerequested); /*Busywait - don't do anything until valuerequested is true*/
  valuerequested = false;
}
874  Using Arduino / Programming Questions / Re: .cpp and .h file locations on: November 27, 2011, 08:19:15 pm
You'll want to have the pitches.h file in the same directory as your .pde file. The IDE creates a .cpp file out of your .pde file after it adds some things, the location of which can be found when holding shift while compiling (but not uploading).

Also, you'll want to use this syntax:
Code:
#include "pitches.h"
875  Using Arduino / Programming Questions / Re: Sampling Rate on: November 25, 2011, 09:37:39 pm
Quote
But to get there you need to forget about the Arduino ADC sw layer and program directly the ADC registers (not difficult), and also condition your signal appropriately.

Can you show how?

There's a fine example in arduino-00xx/hardware/arduino/cores/arduino/wiring_analog.c and the datasheet for the 328 is certainly helpful.
876  Using Arduino / Programming Questions / Re: Inconsistency: Baffled by #ifdef and #include on: November 25, 2011, 09:33:13 pm
Things you don't use are not included.

So you aren't getting those extra objects unless you "pull in" the library. However once you refer to the library, you get the pre-instantiated objects.

Isn't that the result of the -fdata-sections and -ffunction-sections compiler flags?
877  Using Arduino / Programming Questions / Re: Serial Monitor - Can it continually print to top line? on: November 25, 2011, 07:42:50 pm
I think this may work on windows (haven't tried it though).

\r is carriage return and moves the cursor to the beginning of the line without going to the next one. You'll probably have a problem if your second message is shorter than the first one.

Code:
void setup() {
  Serial.begin(9600);
}

void loop() {
  int rand = random(0, 10);
  Serial.print("\r");
  Serial.print(rand);
  delay(500);
}
878  Using Arduino / Microcontrollers / Re: What to turn off, and how? on: November 24, 2011, 01:36:44 am
Your best bet is to look in the datasheet. It's really not that bad if you know what you're looking for, and I hadn't even thought of it as a good place to find information.

Here's a similar project.

Also, please don't cross-post.
879  Using Arduino / Programming Questions / Re: Waiting for Key pressed (keypad) on: November 22, 2011, 09:10:28 pm
How do you expect the key variable to change while you're looping? Put in the getKey function itself, or call it within the while loop, so that you get the current value.

Code:
int key = KeypadX.getKey();
while (key == NO_KEY) key = KeypadX.getKey();
880  Using Arduino / Programming Questions / Re: Switch case problem.... on: November 21, 2011, 08:33:04 pm
Try the randomSeed function on an unconnected analogRead pinor store a random value in EEPROM that's used to seed. If all else fails, get a geiger counter.
881  Using Arduino / Programming Questions / Re: compiler warnings on: November 20, 2011, 11:48:24 pm
What I did is put a script in place of avr-g++ that calls the real avr-g++ with the same flags -- except it ignores the -w flag (disable warnings) and adds a -Wall flag (enable all warnings).

Of course, on Windows it's a lot harder.

Note that the standard libraries that come with Arduino have a ton of warnings in them, and few people will test their own libraries for warnings either.
882  Using Arduino / Programming Questions / Re: ISR Questions on: November 20, 2011, 01:46:09 pm
You could try using the timer1 library.

Code:
#include <TimerOne.h>

volatile unsigned int shotCount = 0;
volatile unsigned int shotsPerSecond = 0;

void setup() {
  Timer1.initialize(1000000UL); // 1000000 microseconds (unsigned long) is 1 second
  Timer1.attachInterrupt(oneSecInterrupt);
}

void loop() {
  if (ready) shotCount ++;
}

void oneSecInterrupt() {
  shotsPerSecond = shotCount;
  shotCount = 0;
}
 
883  Development / Other Software Development / Re: "Virtual" Timer Template Sketch on: November 19, 2011, 07:13:28 pm
That looks exactly like millis(), except less efficient.
884  Using Arduino / Programming Questions / Re: Delay required for accurate Serial.read ArduinoBT on: November 18, 2011, 09:01:21 pm
Well sending each byte isn't instant is it? Why don't you change the
Code:
while (Serial.available() > 0)
to
Code:
if (Serial.available() > bytesneeded)

So you process the data after the sender is finished sending rather than after it sent the first byte.
885  Using Arduino / Programming Questions / Re: PLEASE HELP! on: November 17, 2011, 01:32:53 am
Yeap the way you suggest is workable too.Anyway is possible as long as it's wireless and involves xBees,Arduino and the USB joystick.Do you have a sample code or website?

That was a question. For all we know, all you have is two xbees, an arduino, and a blender.

What hardware do you have, and what was your idea for how to logically connect it together?
Pages: 1 ... 57 58 [59] 60 61 ... 68