Loading...
  Show Posts
Pages: 1 ... 380 381 [382] 383 384 ... 426
5716  Using Arduino / General Electronics / Re: Arduino - H Bridge - 12v DC Motor - External Power Supply on: May 16, 2011, 11:00:03 am
Note that the schematic shows a motor power supply of "2-5V".  I don't think it will work if the power voltage is higher than the logic level.
5717  Using Arduino / Installation & Troubleshooting / Re: Using Diecimila as AVR ISP for a ATmega8 on: May 16, 2011, 10:42:19 am
The device signature looks fine for the ATmega8.  I suspect you got the signature error when using Arduino0022 because you had not disabled auto-reset.  You might want to disable the auto-reset on the Diecimila and try to burn the bootloader again using Arduino0022.

5718  Development / Other Hardware Development / Re: Arduino ISP Shields on: May 16, 2011, 10:23:18 am
If you are going to be custom programming some ATmega chips you may want to get the HV Rescue Shield 2 from MightyOhm.com.  It allows you to re-set the fuses on almost any AVR DIP processor (28 pin, 20 pin and 8 pin).  It uses high-voltage parallel programming so it doesn't need the AVR chip to have a valid clock.  Even if serial programming has been accidentally disabled the HVRS2 can reset the chip to factory settings.

An $13 ISP Shield from Evil Mad Science:
http://evilmadscience.com/productsmenu/tinykitlist/253
It looks like it only supports28-pin ATmega8/168/328 processors.

$3 for the bare board:
http://evilmadscience.com/productsmenu/tinykitlist/254
5719  Topics / Robotics / Re: timing a movement for a watch winder on: May 16, 2011, 09:11:55 am
Code:
#include <Servo.h>
 
Servo myservo; 
 
int pos = 0;   
 
void setup()
{
}
 
 
void loop()
{
   for (int i=0; i<10; i++)
        {
       
        myservo.write(100);    // Pre-set the motor speed
        myservo.attach(9);     // Attach the servo to start the motor spinning
        delay(30L*60L*1000L);  // Wait 30 minutes
        myservo.write(92);    //  Set the motor speed to zero (between forward and backward)
        myservo.detach();     // Stop sending pulses to the servo
        delay(15L*60L*1000L);  // Wait for 15 minutes before running again
        }
   delay(990L*60L*1000L);  // Wait for 990 minutes
}
5720  Using Arduino / Storage / Re: Read txt file into array from SD on: May 16, 2011, 08:59:10 am
I thought the code was 14 characters because that's how many you were copying. For a 12-character code:

Code:

const int IDLEN = 12;
const int NAMELEN = 27;

char currline[IDLEN + 1 + NAMELEN];  // ID, plus comma, plus Name
char id[IDLEN+1];  // ID plus a null terminator
char name[NAMELEN + 1]; // Name plus a null terminator

while (sdin.getline(currline, sizeof currline, '\n'))
    {
    char *line = currline;
    int i;

   for (i=0; i < IDLEN; i++)
      id[i] = *line++;
   id[i] = '\0';  // Make it a valid string by adding a terminator.

  line++;  // Skip the comma in the line
     
   for (int 1=0; i < NAMELEN; i++)
      name[i] = *line++;
   name[i] = '\0';  // Make it a valid string by adding a terminator
[/quote]
5721  Using Arduino / Motors, Mechanics, and Power / Re: powering 64 rgb led matrix kinda. on: May 16, 2011, 08:17:45 am
It's probably a bad move to connect an external battery pack to an Arduino pin.

You can drive a single LED directly from an Arduino pin so you don't need a separate battery pack for that. Here is an example wiring diagram:

http://arduino.cc/en/Tutorial/Blink

Schematic for driving multiple LEDs from a single pin using a 2N2222 transistor:

http://arduino.cc/playground/uploads/Learning/multiple_leds2.jpg
5722  Using Arduino / Networking, Protocols, and Devices / Re: Arduino "Wire" i2c not compatible with SMBus Block Read ... is it? on: May 16, 2011, 08:03:59 am
Also, it was mostly designed for my use, but since I had to ask for help in the forum (and got it, thanks!), I figured I'd return my work to the community smiley

Glad I could help and thanks for the code.
5723  Topics / Robotics / Re: timing a movement for a watch winder on: May 15, 2011, 08:44:01 pm
void loop()
    {
   for (int i=0; i<10; i++)
        {
        startMotion();
        delay(30L*60L*1000L);  // 30 seconds
        stopMotion();
        delay(15L*60L*1000L);  // 15 seconds
        }
   delay(990L*60L*1000L);  // 990 seconds
    }
5724  Using Arduino / Microcontrollers / Re: Looking for the right document(s) on: May 15, 2011, 08:37:55 pm
It is a bit confusing but when you pass pin numbers to pinMode, digitalRead, digitalWrite, or analogWrite, the value is the Arduino digital pin number.  You find them printed on the Arduino board.  The analogRead function uses the Arduino analog input pin numbers (0-5 for most, 0-7 for the Nano).  The analog input pins can also be used as digital pins:  analog inputs 0..7 are also known as digital pins 14..21.

If you want to use direct port access you can find look-up tables that show the mapping from port and bit to Arduino pin.  You can also look at the schematic for your board.
5725  Using Arduino / Networking, Protocols, and Devices / Re: Arduino "Wire" i2c not compatible with SMBus Block Read ... is it? on: May 15, 2011, 08:05:37 pm
In this old forum entry:  http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1214872633 someone was having trouble with an SMBus device using the "Wire" library so they switched to an i2cmaster library and that worked.  Perhaps that library will help with your problem.

5726  Using Arduino / Motors, Mechanics, and Power / Re: Arduino beating up my servos on: May 15, 2011, 07:17:07 pm
I wonder if something damaged the crystal and you're getting the wrong clock speed.  I would not think so because the serial baud rate would be off b the same amount and uploads would stop working.  Are you sure you didn't add anything to your code around the time of the accident?

Try some of the servo example sketches to see if they behave normally.  If so, it's your code.
5727  Using Arduino / Microcontrollers / Re: Blink on AtTiny85 on: May 15, 2011, 07:12:39 pm
If Pin 0 is used for serial I/O like on a regular Arduino that might cause some voltage to seep into the LED.  Did you disconnect from the serial port after uploading the sketch?
5728  Using Arduino / Programming Questions / Re: Serial Monitor on: May 15, 2011, 07:06:57 pm
Serial.read() does not wait for input.  This is how you wait:

Code:
while(!Serial.available())  /* DO NOTHING */;  // Wait for a character to be availble
char input = Serial.read();

or

int input;
while ((input = Serial.read()) == -1) /*KEEP TRYING*/;  // Read until we don't get -1 (=no data available)
5729  Using Arduino / Networking, Protocols, and Devices / Re: Using AT Commands Using Arduino on: May 15, 2011, 06:59:16 pm
Code:
// Shouldn't there be a one second delay BEFORE the attention signal as well?
Serial.print('+++');
delay(1000);

Serial.print('ATID');  // That's a strange character constant.  You probably want the string constant "ATID". Note the double-quotes.
5730  Using Arduino / Storage / Re: Read txt file into array from SD on: May 15, 2011, 06:52:00 pm
You forgot to add a null terminator at the end of the ID.  The println() function takes a character pointer and prints characters until it gets to a null character.  You are also moving 14 characters (0..13) into an array sized for 13.  Bad move.  Change ID  (and name) to contain one more character than you copy.

Code:
char currline[40];
char id[15];  // 14 characters plus  a null terminator

while (sdin.getline(currline, 40, '\n'))
    {
    char name[40-15+1];
    char *line = currline;
    int i;

   for (i=0; i < 14; i++)
      id[i] = *line++;
   id[i] = '\0';  // Make it a valid string by adding a terminator.

  line++;  // Skip the comma in the line
     
   for (int 1=0; i < sizeof name; i++)
      name[i] = *line++;
   name[i] = '\0';  // Make it a valid string by adding a terminator

  if (!myFile.open("CLASS.TXT", O_WRITE | O_CREAT | O_APPEND)) {
    sd.errorHalt();
  }
  // if the file opened okay, write to it:
  myFile.println(name);
  myFile.println(id);
  myFile.close();

}

sdin.close();
Pages: 1 ... 380 381 [382] 383 384 ... 426