Show Posts
Pages: 1 ... 383 384 [385] 386 387 ... 600
5761  Using Arduino / Project Guidance / Re: Chronometer for modelism project ! on: May 03, 2012, 11:46:48 am
Perhaps this example will help.  Segments are connected to pins 5 through 12.  Digits are connected to pins 14, 2, 3, and 4.

Code:
// Digit select lines, right to left
#define DIGIT4 14  // LSD
#define DIGIT3 2
#define DIGIT2 3
#define DIGIT1 4  // MSD

// Bit maps for the seven segment display
const unsigned char Segments[] =
{
  0b11000000, // 0
  0b11001111, // 1
  0b10100100, // 2
  0b10000110, // 3
  0b10001011, // 4
  0b10010010, // 5
  0b10010000, // 6
  0b11000111, // 7
  0b10000000, // 8
  0b10000011, // 9
};


// List of digit select lines, least significant digit first
const unsigned char Digits[4] = {
  DIGIT4, DIGIT3, DIGIT2, DIGIT1};


void setup()
{
  for (int i=2; i<15; i++)
  {
    pinMode(i,OUTPUT);
    digitalWrite(i,LOW);
  }
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);
}

void loop()
{
  // Get time since last reset
  int clock;

////////  Set 'clock' to the 4-digit integer to be displayed

  // Display each digit, right to left
  for (int i=0; i<4; i++)
  {
   
    // Peel a digit off the low end of the number
    int digit = clock % 10;
    clock /= 10;
   
    // Blank the MSD if it is zero
    if (i==3 && digit == 0)
    {
      for (int s=5; s<12; s++)
        digitalWrite(s,HIGH);
    }
    else
    {
      // Display the digit on the seven segments
      unsigned char segments = Segments[digit];
      for (int s=5; s<12; s++)
      {
        digitalWrite(s,segments & 1);
        segments >>= 1;
      }
    }

    // Turn on the digit briefly
    digitalWrite(Digits[i], HIGH);  // Select one digit
    delay(3);
    digitalWrite(Digits[i], LOW);
  }
}
5762  Using Arduino / Networking, Protocols, and Devices / Re: Query please guide on: May 03, 2012, 11:38:45 am
Your problem there is that 0x0B doesn't fit in three bits.  smiley-sad

Do you have a pointer to the documentation?  Perhaps someone else reading the document would be able to interpret it for you.
5763  Using Arduino / Project Guidance / Re: Java on Arduino on: May 03, 2012, 11:34:28 am
You may be in luck.  There is a Java Virtual Machine for the AVR family of processors of which the ATmega328p is a member:

http://www.harbaum.org/till/nanovm/index.shtml

Looks like your Java byte code goes into EEPROM.

The source code can be downloaded from http://sourceforge.net/projects/nanovm/
5764  Community / Gigs and Collaborations / Re: Looking for some help, need simple code for project on: May 03, 2012, 11:25:07 am
You should probably get a realtime clock (RTC) chip to track time.  The Arduino is not very good at it.

Code:
void loop()
    {
    int hour, minute;

    hour = RTC.GetHour();  //  Get the hour (0-11) from the RTC chip
    minute = RTC.GetMinute();   //  Get the hour (0-11) from the RTC chip

    int ledIndex =  ((60 * hour) + minute) / 5;
    }
5765  Using Arduino / General Electronics / Re: Current Consumption in Ardunio Mega on: May 03, 2012, 11:15:09 am
The Arduino Mega draws about 60 mA when you power it from 12V through the built-in regulator.  Much of that power is lost in the regulator.
5766  Using Arduino / Microcontrollers / Re: Bootloader for Pro-Mini - Atmega328 3.3V 16MHz on: May 03, 2012, 11:05:09 am
Check the Atmega328 datasheet.
Atmel states that the ATmega328 cannot run at 16 MHz with only 3.3v
It can't work

"Not guaranteed to run" and "cannot run" are two different things.  Lots of people run their 16 MHz ATmega at 3.3v and they almost always work. smiley
5767  Using Arduino / Installation & Troubleshooting / Re: Webclient W5100 shield works only on port 80? on: May 02, 2012, 06:05:30 pm
Makes no sense to me.

Have you tried changing "GET /search?q=arduino HTTP/1.0"?
5768  Using Arduino / Installation & Troubleshooting / Re: Have you met this problem? Pin 9 cannot analogWrite. on: May 02, 2012, 11:26:30 am
The Servo library uses a timer, possibly the same timer that provides the PWM output for Pin 9.  Check the Servo library documentation to see if they mention such a limitation.
5769  Using Arduino / LEDs and Multiplexing / Re: At a loss. What's going wrong with my code/wiring of multiplexing chip? on: May 02, 2012, 07:37:08 am
I don't see anything obviously wrong.  Perhaps a delay(1) just before the analogRead() would help get stable readings.

What is the value of the fixed resistor?  It should probably be 100k or lower.
5770  Using Arduino / Microcontrollers / Re: Bootloader for Pro-Mini - Atmega328 3.3V 16MHz on: May 02, 2012, 07:22:37 am
There's Pro-Mini for 3.3V at 8MHz but not 16MHz.

That's because you aren't supposed to run an ATmega at 16 MHz with a 3.3v supply.

The bootloader doesn't care what the supply voltage is.  If you overclock your 3.3V ATmega to 16 MHz just use the 5V 16 MHz bootloader.
5771  Using Arduino / Installation & Troubleshooting / Re: Webclient W5100 shield works only on port 80? on: May 02, 2012, 07:13:52 am
Does it work from a web browser when you use "http://address:81/"?
5772  Using Arduino / Installation & Troubleshooting / Re: Where are the files hex saved after Verify on: May 01, 2012, 07:27:22 pm
In Arduino Preferences set "Show verbose output during : [X] compilation [ ] upload"

Then when you verify you will get the verbose output that will tell you where the compile was done.  It will be in the second-to-last line:
Quote
/var/folders/cs/p6yz0z1m8xj9lf0059b_lzw00000gn/T/build8229176203510383123.tmp/Blink.cpp.hex
Binary sketch size: 1026 bytes (of a 32256 byte maximum)

Of course it will be different for each build.
5773  Using Arduino / Installation & Troubleshooting / Re: Webclient W5100 shield works only on port 80? on: May 01, 2012, 07:21:09 pm
Are you using Arduino 1.0?  Are you using Files->Examples->Ethernet->WebClient?

When you changed the IP address to the server on your local network did you also change the line:
Code:
  if (client.connect(server, 80)) {
to
Code:
  if (client.connect(server, 81)) {
5774  Using Arduino / Project Guidance / Re: wiichuck without adapter on: May 01, 2012, 07:16:21 pm
You can cut off the connector and wire directly to the cable.  Leave enough wire on the connector so you can determine which wire goes to which contact on the connector.  They may not have a universal color code like USB.
5775  Using Arduino / LEDs and Multiplexing / Re: Help understanding sensor placement on multiplexing schematic on: May 01, 2012, 07:13:20 pm
Each analog multiplexer connects one of 16 pins to an Arduino analog input.  In the diagram each of those 16 pins has a pull-up resistor.  Those are only necessary if your "sensor" is a variable resistor: LDR for light, Thermistor for temperature, PDR for pressure...  In those cases the other end of the sensor goes to Ground and the sensor/resistor combination acts as a voltage divider.

If your 'sensor' is a potentiometer you should leave out the pull-up resistor.  Connect the ends of the pot. to +5 and Ground.  Connect the wiper of the pot. to the input pin.

If your sensor is some other form of voltage source (0 to 5 volts) you should also leave out the pull-up resistor.
Pages: 1 ... 383 384 [385] 386 387 ... 600