Show Posts
Pages: 1 ... 373 374 [375] 376 377 ... 600
5611  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.
5612  Using Arduino / Programming Questions / Re: timer question on: May 20, 2012, 09:57:43 am
Try a state machine:

unsigned long TimerStart;

const int buttonPin = 2;

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

void loop()
switch (state)
    if (digitalRead(buttonPin) == HIGH)
        state =  IN_30_SECOND_INTERVAL;
        TimerStart = millis();

    if (millis() - TimerStart > 30000)
        state =  WAITING_FOR_BUTTON_PRESS;
    if (digitalRead(buttonPin) == HIGH)
        state =  WAITING_FOR_BUTTON_PRESS;
5613  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 . particularly the (char*)pgm_read_word(&(string_table))
5614  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.
5615  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.
5616  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.
5617  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.
5618  Using Arduino / Displays / Re: t6963c Help Needed on: May 19, 2012, 10:29:27 am
Which t6963c library are you using? ?

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.
5619  Using Arduino / Microcontrollers / Re: Update sketch with USB pen drive on: May 19, 2012, 10:21:52 am
There are two ways to do such a thing:

The Arduino can't read a USB FLASH drive and only the bootloader can load data into the internal FLASH of the ATmega chip (where sketches are loaded).  You could add a USB Host Shield to allow access to USB peripherals like a USB FLASH drive.  Then you can write your own bootloader to access the USB FLASH drive and load new programming.

Another choice is to create a small programmer with one of the smaller ATmega chips, an ISP connector on one end and an SD Card slot at the other end.  Then you can give one of those away with each device and send the new programming on an SD card.
5620  Using Arduino / Programming Questions / Re: Setting time on the Ds 1307 RTC on: May 19, 2012, 06:55:15 am
The PC has to send 'T' followed by 10 digits.  Those 10 digits are the value of a time_t variable: the number of seconds since January 1, 1970.
5621  Using Arduino / Programming Questions / Re: changing pwm on: May 18, 2012, 09:14:59 am
Each of the timers can control two PWM pins.  You can certainly use the timers independent of the analogWrite() library to generate a wide range of PWM frequencies.  What frequency do you want?
5622  Using Arduino / General Electronics / Re: Arduino Digital Output Pin Voltage on: May 18, 2012, 08:51:11 am
Did you measure Vcc?  If you are using USB power it can be 4.75V to 5.25V.

The ATmega running at Vcc=5V will treat anything over 3.0V (5V*0.6) as a logic HIGH so there is plenty of margin.

The ATmega328P is a low-power CMOS (Complementary Symmetry Metal Oxide Semiconductor) chip.  It can run on a wide range of voltages.  When it runs at 5V it is compatible with TTL logic levels.
5623  Using Arduino / LEDs and Multiplexing / Re: two leg, bi-color led control. on: May 18, 2012, 08:33:33 am
Do you need to individually control 6 bi-color LEDs?  If you don't have 12 pins to spare you could always use more shift registers.

Did you want to control all 6 bi-color LEDs together with two pins?  I think that can be done with two transistors each:

+5 ----- Resistor ---(a)--- LED ---(b)--- Resistor ----- +5

Use NPN transistors to ground point (a) for one color and point (b) for the other color.  The transistors should be able to share a common data pin but may need separate base resistors.
5624  Using Arduino / Networking, Protocols, and Devices / Re: EM-406a GPS Sensor Issues w Nano Atmega328 on: May 18, 2012, 08:15:05 am
Are you running the Nano at 5V?  If so I don't think 2.85V logic levels will be high enough. 

When run at 2.4V to 5.5V the ATmega needs Vcc*0.6 or higher to read a logic HIGH.  At Vcc=5V that would be 3V.  The absolute maximum Vcc you can use and expect 2.85V to read as HIGH is 4.75V. Try running the Nano at a lower voltage like 4.5V (three alkaline AA cells in series connected to Gnd (-) and +5V (+))  Then the logic threshold would be 2.7V. 

Note: You can go to an even lower voltage to get more signal margin but aren't supposed to run a 16 MHz ATmega at less than 3.78V.
5625  Using Arduino / Motors, Mechanics, and Power / Re: One Servo with Two Switches on: May 17, 2012, 09:10:33 pm
Once again, thank you very much. I used the void loop you made for me and it works perfectly. Thank you.

I hope I made it clear enough so you could understand how it was working in case you wanted it to work differently.

Note that these variations all have roughly the same effect:
    pos = pos + 1;
    pos += 1;

Typically one would use pos++ for increment and pos-- for decrement but I used the slightly more verbose "pos += 1" and "pos -= 1" to be more explicit.

Pages: 1 ... 373 374 [375] 376 377 ... 600