Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 592
61  Using Arduino / Programming Questions / Re: Please help for MQ2 programming on: August 14, 2014, 11:14:05 am
The MQ2 uses a lot of power all the time because you have to keep the heater running.
I would recommend a DHT11 temperature/humidity sensor:  http://www.adafruit.com/products/386
62  Using Arduino / Microcontrollers / Re: Arduino Mega 3.3V 8Mhz on: August 14, 2014, 06:43:44 am
You should be able to use the existing bootloader at 8MHz by using an upload baud rate of 57600 instead of 115200:

Code:
##############################################################
mega8m2560.name=Arduino Mega 2560 at 8MHz

mega8m2560.upload.protocol=wiring
mega8m2560.upload.maximum_size=258048
mega8m2560.upload.speed=57600

mega8m2560.bootloader.low_fuses=0xFF
mega8m2560.bootloader.high_fuses=0xD8
mega8m2560.bootloader.extended_fuses=0xFD
mega8m2560.bootloader.path=stk500v2
mega8m2560.bootloader.file=stk500boot_v2_mega2560.hex
mega8m2560.bootloader.unlock_bits=0x3F
mega8m2560.bootloader.lock_bits=0x0F

mega8m2560.build.mcu=atmega2560
mega8m2560.build.f_cpu=8000000L
mega8m2560.build.core=arduino
mega8m2560.build.variant=mega
##############################################################
63  Using Arduino / Networking, Protocols, and Devices / Re: How to receive data via SPI on: August 14, 2014, 06:29:00 am
You receive at the same time you send.  Every time the clock pin goes active the Slave grabs the data on the MOSI line and shifts it into a shift register while the Master grabs the data from the MISO line and shifts it into a shift register.  After 8 clocks the SPI.transfer() returns the data that was received during that send.
But wont I have to set an interrupt on the SS line to tell the slave the master wishers to transfer data?
I mean the slave could be doing something else. Or is this internally taken care by hardware as in DMA?

If you want to use an Arduino as a SPI Slave you can learn from this example:

http://www.gammon.com.au/forum/?id=10892&reply=1#reply1

It uses the SPI interrupt which signals the arrival of a byte of data.
64  Using Arduino / LEDs and Multiplexing / Re: Arduino + Shift register + 4 digit 7 seg. display and only can get 8 to display? on: August 14, 2014, 06:17:03 am
I would expect the register clock to be pulsed low every half second and the serial clock to be pulsed low eight times every half second.  The pulses may be too short to detect with a multimeter.  Do you know anyone with an oscilloscope?
65  Using Arduino / Sensors / Re: How to use Ultrasonic sensor with IR control on: August 14, 2014, 06:07:54 am
I think this line has to go back in somewhere:

Code:
    irrecv.resume(); // Receive the next value
66  Using Arduino / Project Guidance / Re: Sending data to 2 ports without delay on: August 13, 2014, 06:24:20 pm
Ok, so i am guessing I set whatever line a want for CS low, transfer all the 4 bites, as I do with the two above and then turn the line high again, is this right?

Yes.
67  Using Arduino / Networking, Protocols, and Devices / Re: How to receive data via SPI on: August 13, 2014, 06:16:07 pm
You receive at the same time you send.  Every time the clock pin goes active the Slave grabs the data on the MOSI line and shifts it into a shift register while the Master grabs the data from the MISO line and shifts it into a shift register.  After 8 clocks the SPI.transfer() returns the data that was received during that send.

Typically the received data will lag behind the sent command by at least a byte since the Slave won't usually know what the Master wants until it has received an entire command.  The Master continues to send dummy data (typically 0) to clock in the data from the Slave:

Code:
digitalWrite(SlaveSelectPin, LOW);  // Select the Slave device
SPI.transfer(COMMAND);
byte returnedValue = SPI.transfer(0);
68  Using Arduino / LEDs and Multiplexing / Re: Arduino + Shift register + 4 digit 7 seg. display and only can get 8 to display? on: August 13, 2014, 06:07:07 pm
You should not have current limiting resistors on the common (digit) pin, only on the individual (segment) pins.

If my understanding is correct, you have the common anode for one digit connected to +5V (through an unnecessary resistor).  The cathodes for the segments go through a current limiting resistor to the outputs of the 74HC595 shift register.  Taking the pins LOW should turn on the connected segment.  Perhaps the shift register isn't getting power and all of the segments are being grounded through the chip.  That would cause all the segments to light up.

Are you sure you have MR (Master Reset) pulled HIGH and OE (Output Enable) pulled low?
69  Using Arduino / Project Guidance / Re: 5V stepper motor doesn't spins! on: August 13, 2014, 05:21:53 pm
Often this means that two of your stepper motor wires are swapped.
70  Using Arduino / Programming Questions / Re: Reading several onewire sensors on: August 13, 2014, 05:17:50 pm
It might work better if you selected devices by their 64-bit address rather than their index.  I don't know if either library is smart enough to only index devices that it understands.
71  Using Arduino / Networking, Protocols, and Devices / Re: SPI conflict with Uno, Ultimate GPS Logger, and Thermocouple Multiplexer on: August 13, 2014, 05:13:22 pm
Which CS pin do you have selected on the Thrermocouple Mux: 8, 9, or 10?

Does the logger shield use Pin 4, 5, 6, or 7 for anything?
72  Using Arduino / Sensors / Re: How to use Ultrasonic sensor with IR control on: August 13, 2014, 04:56:28 pm
controle() is incorrect.  It checks to see if ANOTHER IR message has arrived and it only gets called when a message has arrived.

Remove this part:
Code:
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);

    armazenavalor = (results.value);

and remove the matching close-bracket.  Use the value that loop() saved in armazenavalor.

You can also take out this part because it is already done in loop():
Code:
    if (armazenavalor == 0xFF9867) //Verifica se a tecla 1 foi acionada
    {
      sensor();
    }
73  Using Arduino / Project Guidance / Re: Sending data to 2 ports without delay on: August 13, 2014, 04:48:04 pm
Suppose I want to send 32bits of data via SPI using the above method.
How would this be done?

Call SPI.transfer() for each of the four bytes in your 32-bit value.
74  Using Arduino / General Electronics / Re: Arduino Leonardo unable to power my motor? on: August 13, 2014, 04:41:40 pm
So I should connect the B to pin 2 in my case and the C to the power supply and E to the Arduino GND pin next to the 5V pin. I have a few BC547 PNP transistors that I scraped of old electronics. This should turn on the motor when setting pin 2 to high right?

Two changes:
    Use an NPN transistor, not PNP.
    Since the Base/Emitter junction acts like a diode to Ground you should add a resistor between Pin 2 and Base.  About 100-200 Ohms.
75  Using Arduino / Programming Questions / Re: FTDI usb-serial VS arduino uno usb-serial converter on: August 13, 2014, 07:12:45 am
My best guess would be this file from Arduino 1.0.5:

hardware/arduino/firmwares/atmegaxxu2/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex
Pages: 1 ... 3 4 [5] 6 7 ... 592