Show Posts
Pages: 1 2 3 [4] 5 6 ... 580
46  Using Arduino / Programming Questions / Re: Can i use TX pin or pin 4 on Arduino Ethernet? on: July 20, 2014, 06:54:52 pm
I think the answer is YES to both.  Also remember that A0-A5 can act as digital I/O pins.
47  Using Arduino / Programming Questions / Re: Encountering Issues with If Else Statement & PIR Sensor on: July 20, 2014, 06:52:44 pm
so like this, inside the first digitalRead block?

Getting closer but this part doesn't make sense:
Code:
 else (digitalRead(motionPin) == LOW); { // door is closed so do reset messageSent and doorOpen states
    doorOpen = false; //door is not open
    messageSent = false; //reset the message status
    Serial.println("DOOR IS CLOSED");
  }

The 'else' clause should not be followed by a boolean expression because the 'else' is always 'anything that does not match the 'if'.  Since the 'else' can only be followed only by a statement or block {} the block it's taking that boolean expression to be an "expression statement" which is the sole contents of the 'else'.   That is why you had to put a semicolon after it, to terminate the statement.

What you wrote is equivalent to writing:
Code:
 else {
      digitalRead(motionPin) == LOW;  // This does nothing.  It reads the pin, compares to LOW and throws away the answer
   }
   // Do this every time through loop():
   { // door is closed so do reset messageSent and doorOpen states
    doorOpen = false; //door is not open
    messageSent = false; //reset the message status
    Serial.println("DOOR IS CLOSED");
  }
48  Using Arduino / Programming Questions / Re: Encountering Issues with If Else Statement & PIR Sensor on: July 20, 2014, 03:45:45 pm
Code:
  else (digitalRead(motionPin == HIGH) && (messageSent == false)); { //if the door is open, and the messageSent state

That line is nonsense.  Perhaps you meant:

Code:
  else if (digitalRead(motionPin) == HIGH && (messageSent == false)) { //if the door is open, and the messageSent state

But that line won't do anything because you already covered both the "digitalRead(motionPin) == HIGH" and "digitalRead(motionPin) == LOW" cases so this 'else' line will never be executed.  If you want to check for both
"digitalRead(motionPin) == HIGH"  and  "messageSent == false" you should put:
Code:
if (messageSent == false)
INSIDE the "digitalRead(motionPin) == HIGH" block.
49  Using Arduino / Project Guidance / Re: Help with TTP22 on: July 20, 2014, 09:05:26 am
It's all spelled out in the datasheet:
http://www.go-gddq.com/down/2014-04/14040113211635.pdf

I'd use the I2C mode.  Looks fairly straightforward.  Send the address byte, read two data bytes.
50  Using Arduino / Programming Questions / Re: find value in long table. on: July 20, 2014, 08:43:21 am
Code:
struct Entry {
    int key;
    int data;
} table[] = {{100,5000}, {200,7500},{300,11000}};

int FindInTable(int key) {
   for (int index = 0;  index < sizeof table / sizeof table[0]; index++)
       if (table[index].key == key)
          return table[index].data;
    return -1;
}
51  Using Arduino / Programming Questions / Re: Hold input for set time on: July 20, 2014, 08:35:46 am
Start with figuring out what steps YOU would take to perform the task manually.

1) Take an empty post-it note
2)  Wait for the button to be pushed.
3) if the post-it note is empty:
           go to Step 5
4) if the post-it note is not empty:
          If the time on the post-it note is less than five seconds before now:
                   Set the lights!
         erase the post-it note
5)    write down the time
6)     wait for the button to be released
7)     go back to Step 2
52  Using Arduino / LEDs and Multiplexing / Re: Li-ion charger on: July 20, 2014, 08:23:04 am
anyone know how to or what i need to buy to make a Li-ion charger? i need it for 18650 batteries

There is the LTC4056 Li-ion charger chip: http://www.linear.com/product/LTC4056-4.2
53  Using Arduino / Project Guidance / Re: Overlay GPS code error, looking forward for another codes. on: July 20, 2014, 08:09:38 am
Are you sure you are using the ENHANCED version of the TVOut library as described here:
http://nootropicdesign.com/ve/

54  Using Arduino / Project Guidance / Re: Speeding up sample rate - Data logger on: July 20, 2014, 07:44:24 am
Open the file in setup() instead of every time through loop().

If the SD card isn't fast enough, try an external FRAM chip.
55  Using Arduino / General Electronics / Re: ebay relay boards on: July 20, 2014, 07:31:03 am
You could always add some heavy wire in parallel with the traces if you were worried about them.
56  Using Arduino / Programming Questions / Re: operating mode servo library on: July 20, 2014, 07:13:10 am
The pulses are sequential but not the refresh interval.  For example, if you have 5 servos set to 1500 microseconds and the default refresh interval of 20,000 microseconds you will get all the pulses out in 7,500 microseconds (7.5 milliseconds) and then a pause of 12,500 microseconds.  If the servos are all at 1000 microseconds it will be 5,000 microseconds for the pulses and 15,000 microseconds of pause.  If the servos are all all 2000 microseconds you will have 10,000 microseconds of pulse and 10,000 microseconds of pause.

If you set REFRESH_INTERVAL to 1000 the pulses will repeat immediately, giving a refresh interval of 5 to 10 milliseconds (200 to 100 updates per second.

What the code is doing:
Code:
static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t *TCNTn, volatile uint16_t* OCRnA)
{
  if(/* This interrupt signals the end of the REFRESH_INTERVAL */)
    *TCNTn = 0; // Re-start the timer at 0
  else {
    if( /* The interrupt signals the end of pulse on this Channel. If this channel is active (not detached):  */ ) 
      digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,LOW); // Turn off the pin for this Channel
  }

  Channel[timer]++;    // increment to the next Channel

  if( /* We have not gone past the list of servos for this timer */) {
    // Set the timeout for this timer to currentTime + pulse length for the new Channel
    if(/* This Channel's pin is active (not detached): */) 
      digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // Turn on the pin for this Channel
  } 
  else {
    // finished all channels so wait for the refresh period to expire before starting over
    if( /* The current time is less than REFRESH_INTERVAL - 4 */) )  // allow a few ticks to ensure the next OCR1A not missed
      // Set the timeout to REFRESH_INTERVAL; 
    else
      // Set the timeout to four ticks from NOW
    Channel[timer] = -1; // This means the next interrupt signals the end of the REFRESH_INTERVAL
  }
}
57  Using Arduino / Installation & Troubleshooting / Re: No serial port recognition arduino uno on: July 19, 2014, 03:43:57 pm
Did you try another USB cable?  A different USB port on your Mac?
58  Using Arduino / Installation & Troubleshooting / Re: arduino uno error on: July 19, 2014, 03:40:58 pm
What do the RX and TX lights do when you try to upload a sketch?
59  Using Arduino / LEDs and Multiplexing / Re: MAX7219 8X8 not working on: July 19, 2014, 03:38:19 pm
Could it be you have your anodes and cathodes swapped?

Have you tried an example sketch from a 7219 library to be sure everything is wired correctly?
60  Topics / Device Hacking / Re: Hack NITGEN fingerprint sensor on: July 19, 2014, 03:26:58 pm
can i use pl-2303 converter?
my nitgen device is Nitgen HFDU14

That is for connecting a serial port to a USB Host. It won't help you connect a USB Client to a serial port.

If you don't mind hacking the device you may find something like the PL-2303 chip inside it.  If you remove that chip and connect wires to where the RXD pin (pin 5) and TXD pin (pin 1)  were you can probably connect THAT to the Arduino.
Pages: 1 2 3 [4] 5 6 ... 580