Show Posts
Pages: 1 ... 8 9 [10] 11 12
136  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 01:13:23 pm
the looop start and stop again or still countdown ?
137  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 01:10:32 pm
When send a pulse IR is a pulse 13usec High,13usecs Low,13usec High,13usecs Low,13usec High,13usecs Low,13usec High,13usecs Low....for 700usecs the loop work counter when pulse is high only for 13usecs or for total time 700usecs?
138  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 01:01:45 pm
My basic question is why pin 2 still high?The Pulse Ir is high ,low every 13usec when fall to zero what happen ?How read this?The pin arduino or ir receiver has internal small capacitor?
139  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 11:53:42 am
toyotomi a/c on pulse with resolution 20usec

Ready to decode IR!



Received:

OFF    ON
45204 usec, 8940 usec
4420 usec, 760 usec
400 usec, 680 usec
420 usec, 680 usec
1500 usec, 680 usec
1520 usec, 700 usec
1500 usec, 680 usec
400 usec, 700 usec
400 usec, 680 usec
420 usec, 680 usec
400 usec, 700 usec
400 usec, 680 usec
1500 usec, 700 usec
1500 usec, 680 usec
1500 usec, 680 usec
420 usec, 680 usec
400 usec, 700 usec
400 usec, 680 usec
1500 usec, 700 usec
420 usec, 660 usec
440 usec, 680 usec
1500 usec, 680 usec
1500 usec, 700 usec
400 usec, 680 usec
1500 usec, 700 usec
400 usec, 680 usec
420 usec, 680 usec
400 usec, 700 usec
1500 usec, 680 usec
400 usec, 700 usec
400 usec, 680 usec
420 usec, 680 usec
400 usec, 700 usec
400 usec, 680 usec
420 usec, 680 usec
400 usec, 700 usec
1500 usec, 680 usec
1520 usec, 660 usec
1500 usec, 720 usec
1500 usec, 680 usec
1500 usec, 680 usec
1500 usec, 700 usec
400 usec, 680 usec
440 usec, 660 usec
400 usec, 700 usec
400 usec, 680 usec
420 usec, 680 usec
400 usec, 700 usec
1500 usec, 680 usec
1520 usec, 660 usec
1520 usec, 700 usec
1500 usec, 680 usec
1500 usec, 680 usec
1500 usec, 700 usec
400 usec, 680 usec
440 usec, 660 usec
400 usec, 700 usec
400 usec, 680 usec
440 usec, 660 usec
400 usec, 700 usec
420 usec, 660 usec
420 usec, 680 usec
400 usec, 700 usec
1520 usec, 660 usec
400 usec, 700 usec
1520 usec, 660 usec
1520 usec, 680 usec
420 usec, 680 usec
1500 usec, 680 usec
420 usec, 500 usec

when i decrease resolution to 1 usec the time 400usec became 250usecs...

the toyotomi ok on
but i have another a/c united no work...
140  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 11:18:35 am
Arduino work with 16MHz....every cycle is 62.5 nanoseconds....i could use this for more precision?
141  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 11:14:17 am
If i remove delay from the code....i measurement the high pulse general or only the total time when the bit is 1 high for 13usecs (38KHz)?
142  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 11:11:05 am
Arduino Duemilanove Mega328
143  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 11:04:29 am
Code:
/* Raw IR decoder sketch!
 
 This sketch/program uses the Arduno and a PNA4602 to
 decode IR received. This can be used to make a IR receiver
 (by looking for a particular code)
 or transmitter (by pulsing an IR LED at ~38KHz for the
 durations detected
 
 Code is public domain, check out www.ladyada.net and adafruit.com
 for more tutorials!
 */
 
// We need to use the 'raw' pin reading methods
// because timing is very important here and the digitalRead()
// procedure is slower!
//uint8_t IRpin = 2;
// Digital pin #2 is the same as Pin D2 see
// http://arduino.cc/en/Hacking/PinMapping168 for the 'raw' pin mapping
#define IRpin_PIN      PIND
#define IRpin          2
 
// the maximum pulse we'll listen for - 65 milliseconds is a long time
#define MAXPULSE 65000
 
// what our timing resolution should be, larger is better
// as its more 'precise' - but too large and you wont get
// accurate timing
#define RESOLUTION 20
 
// we will store up to 100 pulse pairs (this is -a lot-)
uint16_t pulses[100][2];  // pair is high and low pulse
uint8_t currentpulse = 0; // index for pulses we're storing
 
void setup(void) {
  Serial.begin(9600);
  Serial.println("Ready to decode IR!");
}
 
void loop(void) {
  uint16_t highpulse, lowpulse;  // temporary storage timing
  highpulse = lowpulse = 0; // start out with no pulse length
 
 
//  while (digitalRead(IRpin)) { // this is too slow!
    while (IRpin_PIN & (1 << IRpin)) {
     // pin is still HIGH
 
     // count off another few microseconds
     highpulse++;
     delayMicroseconds(RESOLUTION);
 
     // If the pulse is too long, we 'timed out' - either nothing
     // was received or the code is finished, so print what
     // we've grabbed so far, and then reset
     if ((highpulse >= MAXPULSE) && (currentpulse != 0)) {
       printpulses();
       currentpulse=0;
       return;
     }
  }
  // we didn't time out so lets stash the reading
  pulses[currentpulse][0] = highpulse;
 
  // same as above
  while (! (IRpin_PIN & _BV(IRpin))) {
     // pin is still LOW
     lowpulse++;
     delayMicroseconds(RESOLUTION);
     if ((lowpulse >= MAXPULSE)  && (currentpulse != 0)) {
       printpulses();
       currentpulse=0;
       return;
     }
  }
  pulses[currentpulse][1] = lowpulse;
 
  // we read one high-low pulse successfully, continue!
  currentpulse++;
}
 
void printpulses(void) {
  Serial.println("\n\r\n\rReceived: \n\rOFF \tON");
  for (uint8_t i = 0; i < currentpulse; i++) {
    Serial.print(pulses[i][0] * RESOLUTION, DEC);
    Serial.print(" usec, ");
    Serial.print(pulses[i][1] * RESOLUTION, DEC);
    Serial.println(" usec");
  }
}
144  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 10:52:35 am
The counter work when pin2 something there is ....the pulse?
145  Using Arduino / Programming Questions / How work Raw Ir decoder? on: January 24, 2012, 08:31:00 am
Hello.I need help to understand how work Raw Ir decoder sketch?Why pin 2 is still high?http://www.ladyada.net/learn/sensors/ir.html
The Ir pulse is 01010101....with frequency 38KHz when pulse Ir is high....how counter work when fall to zero for 13usec?

146  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 07:48:23 am
I can't understand how pin is still high ....the pulse is 01010101....38 KHz....?
147  Using Arduino / Programming Questions / Re: Help with shift bits... on: January 24, 2012, 05:09:59 am
This is from http://www.ladyada.net/learn/sensors/ir.html
148  Using Arduino / Programming Questions / Help with shift bits... on: January 24, 2012, 04:38:54 am
Hello.How work this?
Code:
#define IRpin_PIN      PIND
#define IRpin             2
 
//  while (digitalRead(IRpin)) { // this is too slow!
    while (IRpin_PIN & (1 << IRpin)) {
     // pin is still HIGH
 
     // count off another few microseconds
     highpulse++;
149  Using Arduino / Programming Questions / Re: Small help needed with #Define on: January 24, 2012, 04:36:05 am
Hi.How work this?
Code:
#define IRpin_PIN      PIND
#define IRpin             2
 
//  while (digitalRead(IRpin)) { // this is too slow!
    while (IRpin_PIN & (1 << IRpin)) {
     // pin is still HIGH
 
     // count off another few microseconds
     highpulse++;
     
150  Using Arduino / Programming Questions / Re: How i make delay .5 microseconds? on: January 24, 2012, 01:22:18 am
Code:
void pulseIR(long microsecs) {
  // we'll count down from the number of microseconds we are told to wait
 
  cli();  // this turns off any background interrupts
 
  while (microsecs > 0) {
    // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IR_PIN4, HIGH);  // this takes about 3 microseconds to happen
   delayMicroseconds(10);         // hang out for 10 microseconds
   digitalWrite(IR_PIN4, LOW);   // this also takes about 3 microseconds
   delayMicroseconds(10);         // hang out for 10 microseconds

   // so 26 microseconds altogether
   microsecs -= 26;
  }
 
  sei();  // this turns them back on
}

void SendACCodeOn() {
  // This is the code for my particular Toyotomi on button
 
  pulseIR(9000);
   delayMicroseconds(4340);
  pulseIR(840);
   delayMicroseconds(320);
  pulseIR(740);
   delayMicroseconds(400);
  pulseIR(700);
   delayMicroseconds(1440);
  pulseIR(740);
  ........

}
Pages: 1 ... 8 9 [10] 11 12