Show Posts
Pages: 1 ... 372 373 [374] 375 376 ... 600
5596  Using Arduino / General Electronics / Re: breadboard setup (transistor/relay) not working on arduino ? on: May 21, 2012, 07:07:01 am
Perhaps you should find a relay with a 5V 30mA coil so you can drive it directly with an Arduino pin.
5597  Using Arduino / Installation & Troubleshooting / Re: Leonardo on OSX - not in sync when uploading on: May 21, 2012, 06:47:06 am
burned the bootloader using the IDE. It seems to work fine now.

So the bootloader was bad.  Was that a genuine "Made in Italy" Leonardo?  It does not bode well if they are being sold with bad bootloaders. smiley-sad
5598  International / Portugues / Re: ERRO: invalid types 'char[int]' for array subscript on: May 20, 2012, 07:12:07 pm
Code:
int ledPin13 =  13;
int ledPin11 =  11;
int ledPin9  =  9;
int ledPin7  =  7;
int ledPin5  =  5;
int counter  =  0;
char estado  =  LOW;

void setup()   {

  Serial.begin(9600);

  pinMode(ledPin13, OUTPUT);
  pinMode(ledPin11, OUTPUT);
  pinMode(ledPin9, OUTPUT);
  pinMode(ledPin7, OUTPUT);
  pinMode(ledPin5, OUTPUT);

}

void loop()
{
  char caracter;
  caracter = Serial.read();
   
    if(caracter == 1)
    (
      estado = HIGH;
    ) else (
      estado = LOW;
    )
    digitalwrite(caracter[counter], estado)
  }
5599  Using Arduino / Installation & Troubleshooting / Re: Leonardo on OSX - not in sync when uploading on: May 20, 2012, 07:04:29 pm
Do the RX/TX lights on the Leonardo flicker at all when the upload begins?  Are you sure you selected the right serial port?  Are you sure the Leonardo you got has the 1200-baud bootloader expected by boards.txt?
5600  Using Arduino / Displays / Re: Serial Monitor to LCD on: May 20, 2012, 06:58:08 pm
Something like this would do it:
Code:
void setup() (Serial.begin(9600);}
void loop() {
    if (Serial.available())
        lcd.write(Serial.read());
}
5601  Using Arduino / Project Guidance / Re: Accessing PROGMEM string array using index variable does not work on: May 20, 2012, 02:18:28 pm
I don't know why "string_table[5]" works.  If the table was declared 'const' then I would guess that the compiler recognized string_table[5] as a compile-time constant and just used the value rather then generating code to fetch from the array.

To use the array in PROGMEM use 
Code:
(char*)pgm_read_word(&(string_table[x]))
instead of
Code:
string_table[x]
.
5602  Topics / Robotics / Re: Relays or Transistors? on: May 20, 2012, 02:06:17 pm
How to use one:
http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads

Good transistor to use: TIP120 (NPN 60V 5A)

Where to buy one:
http://www.google.com/search?q=TIP120+Transistor&tbm=shop
5603  Topics / Robotics / Re: Relays or Transistors? on: May 20, 2012, 10:01:56 am
If you want to control motor speed you will want to use a transistor or MOSFET because they switch much faster than a relay.

If you just want ON/OFF control you can use a relay but if the relay coil requires more than 5V or more than 30 mA you will need a transistor to drive the relay.

If you want to control the direction as well as speed you will need an H-bridge motor controller.

If you want to control direction but not speed you can use two relays.
5604  Using Arduino / Programming Questions / Re: timer question on: May 20, 2012, 09:57:43 am
Try a state machine:
Code:
enum {WAITING_FOR_BUTTON_PRESS, IN_30_SECOND_INTERVAL} state = WAITING_FOR_BTTON_PRESS;

unsigned long TimerStart;

const int buttonPin = 2;

void setup (){
pinMode(buttonPin, INPUT);
}

void loop()
{
switch (state)
    {
case WAITING_FOR_BUTTON_PRESS:
    if (digitalRead(buttonPin) == HIGH)
        {
        state =  IN_30_SECOND_INTERVAL;
        TimerStart = millis();
        }
    break;

case IN_30_SECOND_INTERVAL:
    if (millis() - TimerStart > 30000)
        {
        state =  WAITING_FOR_BUTTON_PRESS;
        }
    else
    if (digitalRead(buttonPin) == HIGH)
        {
        state =  WAITING_FOR_BUTTON_PRESS;
        }
    break;
    }
}
5605  Using Arduino / Project Guidance / Re: Accessing PROGMEM string array using index variable does not work on: May 20, 2012, 09:19:22 am
string_table is in PROGMEM.  When you index into it as if it were a regular array you are fetching from the wrong memory.  I think you will need to use pgm_read_word().  See the string table example in http://arduino.cc/en/Reference/PROGMEM . particularly the (char*)pgm_read_word(&(string_table))
5606  Using Arduino / Programming Questions / Re: How to read/write FLASH memory without PROGMEM ? on: May 19, 2012, 07:58:53 pm
You wanted an example of how code in the BLS could write into the APS.  The bootloaders do that.  You can use the source code as an example.
5607  Using Arduino / Programming Questions / Re: How to read/write FLASH memory without PROGMEM ? on: May 19, 2012, 07:52:41 pm
any idea of how to get the steps/examples in this area?

Well, the bootloader writes into Application Program Section.  The source code for the bootloaders are included in Arduino 1.0.
5608  Using Arduino / Programming Questions / Re: How to read/write FLASH memory without PROGMEM ? on: May 19, 2012, 06:47:11 pm
Only the Boot Loader Section is allowed to write into the Application Program Section of FLASH at run time.  You will have to put some code in the BLS that you can then call to write data into the APS with the SPM (Store Program Memory) instruction.
5609  Using Arduino / Motors, Mechanics, and Power / Re: One Servo with Two Switches on: May 19, 2012, 04:42:35 pm
Yes it's very clear. I understand it now. Thank you. One last question. Sorry. Is there any way to make the servo go slower? I mean this speed is okay, but slower might work better in my case. Thank you.

Increasing the delay() at the end of loop() would make the servo go slower.  I had it set to 10 milliseconds which allows no more than 100 steps per second.  Change it to a higher value to get slower servo motion.
5610  Using Arduino / Displays / Re: t6963c Help Needed on: May 19, 2012, 10:29:27 am
Which t6963c library are you using?  http://code.google.com/p/arduino-t6963c/downloads/list ?

That library has not been updated for Arduino 1.0 yet.  Change "WProgram.h" in T6963.h and T6963.cpp to "Arduino.h".  That fixes it.
Pages: 1 ... 372 373 [374] 375 376 ... 600