Subversion Repositories Projects

Rev

Rev 838 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 838 Rev 841
Line 164... Line 164...
164
}
164
}
165
 
165
 
166
 
166
 
167
 
167
 
168
/*---------------------------------------------------------------------------------------------------------------------------------------------------
168
/*---------------------------------------------------------------------------------------------------------------------------------------------------
169
 * Get position from servo inputs 1 and 2. Returns 1/2/3 for down/middle/up and 0 for invalid signal
169
 * Get position from servo inputs 1 and 2. Returns 1/2/3 for down/middle/up, 0 for GND and 4 for VCC
170
 *---------------------------------------------------------------------------------------------------------------------------------------------------
170
 *---------------------------------------------------------------------------------------------------------------------------------------------------
171
 */
171
 */
172
unsigned char Servo(unsigned char chan)
172
unsigned char Servo(unsigned char chan)
173
{
173
{
174
  cli();
174
  cli();
Line 225... Line 225...
225
  {
225
  {
226
    if (irmp_get_data (&ir_temp))        // when IR code is decoded,
226
    if (irmp_get_data (&ir_temp))        // when IR code is decoded,
227
    {
227
    {
228
      Servo1 = Servo(1);                 // get Servo positions
228
      Servo1 = Servo(1);                 // get Servo positions
229
      Servo2 = Servo(2);
229
      Servo2 = Servo(2);
230
      ir_temp.flags = 0;                 // ignore reapeat-flag
230
      ir_temp.flags = 0;                 // ignore repeat-flag
231
      ir_data[Servo1][Servo2] = ir_temp; // populate the array
231
      ir_data[Servo1][Servo2] = ir_temp; // populate the array
232
      active[Servo1][Servo2] = mode;     // and flag it with the actually mode
232
      active[Servo1][Servo2] = mode;     // and flag it with the actually mode
233
      Flash(25,25,10);                   // fast flash LED 10 times to indicate a learned code
233
      Flash(25,25,10);                   // fast flash LED 10 times to indicate a learned code
234
    }
234
    }
235
 
235
 
Line 296... Line 296...
296
 
296
 
297
  irmp_init();                           // initialize irmp
297
  irmp_init();                           // initialize irmp
298
  irsnd_init();                          // initialize irsnd
298
  irsnd_init();                          // initialize irsnd
299
  timer_init();                          // initialize timer
299
  timer_init();                          // initialize timer
300
  WaitForKeyRelease();
300
  WaitForKeyRelease();
301
  sei ();                                // enable interrupts
301
  sei();                                 // enable interrupts
302
 
302
 
303
 
303
 
304
  while(1)                               // Main loop
304
  while(1)                               // Main loop
305
  {
305
  {
306
    if (!(PINB & (1<<PINB2))) Learn();   // Enter learning mode when the button is pressed
306
    if (!(PINB & (1<<PINB2))) Learn();   // Enter learning mode when the button is pressed