Show Posts
Pages: 1 [2] 3 4 5
16  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 10, 2012, 04:45:35 pm
Okeydoke. I'll keep track of what I change and report back after I find as many as I can.
17  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 10, 2012, 11:40:53 am
the .cpp file is too large to post here but you can see it in this zip file: http://arcfn.com/files/IRremote.zip
18  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 10, 2012, 11:37:54 am
I can find neither TCCR2A nor COM2B1 in the code or in the .h file it is referencing. I can however find these in the .cpp file in the folder with the code i downloaded. Changing just what you suggested gives me this error when running the code again:

Code:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRsend::enableIROut(int)’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:198:3: error: ‘TIMSK2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:198:14: error: ‘TOIE2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:207:12: error: ‘WGM20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:3: error: ‘TCCR2B’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:12: error: ‘WGM22’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:25: error: ‘CS20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:211:3: error: ‘OCR2A’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:212:3: error: ‘OCR2B’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRrecv::enableIRIn()’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:229:3: error: ‘TCCR2B’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:229:3: error: ‘CS22’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:230:3: error: ‘CS21’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:231:3: error: ‘CS20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:234:3: error: ‘TIMSK2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:234:3: error: ‘TOIE2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:236:3: error: ‘TCNT2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In function ‘void TIMER2_OVF_vect()’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:266:3: error: ‘TCNT2’ was not declared in this scope



19  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 09, 2012, 11:11:09 pm
ok loading the blink sketch is working fine now. However still cannot load the IR code was originally trying to put on the attiny85. I get this compiler error:

Code:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRsend::mark(int)’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:172:3: error: ‘TCCR2A’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:172:13: error: ‘COM2B1’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRsend::space(int)’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:180:3: error: ‘TCCR2A’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:180:15: error: ‘COM2B1’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRsend::enableIROut(int)’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:198:3: error: ‘TIMSK2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:198:14: error: ‘TOIE2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:207:3: error: ‘TCCR2A’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:207:12: error: ‘WGM20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:3: error: ‘TCCR2B’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:12: error: ‘WGM22’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:208:25: error: ‘CS20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:211:3: error: ‘OCR2A’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:212:3: error: ‘OCR2B’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In member function ‘void IRrecv::enableIRIn()’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:224:3: error: ‘TCCR2A’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:229:3: error: ‘TCCR2B’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:229:3: error: ‘CS22’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:230:3: error: ‘CS21’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:231:3: error: ‘CS20’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:234:3: error: ‘TIMSK2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:234:3: error: ‘TOIE2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:236:3: error: ‘TCNT2’ was not declared in this scope
/home/will/sketchbook/libraries/IRremote/IRremote.cpp: In function ‘void TIMER2_OVF_vect()’:
/home/will/sketchbook/libraries/IRremote/IRremote.cpp:266:3: error: ‘TCNT2’ was not declared in this scope
20  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 09, 2012, 10:26:26 pm
Ok I installed the core files.

I uploaded the ISP sketch onto the arduino

I opened the blink example sketch

I selected the Attiny85 from the board menu

I attempt to compile the blink example sketch and get this error:

Code:
In file included from /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:44:0,
                 from /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/delay.h:37,
                 from /home/will/sketchbook/hardware/tiny/cores/tiny/wiring_private.h:32,
                 from /home/will/sketchbook/hardware/tiny/cores/tiny/WInterrupts.c:37:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected ‘)’ before ‘>=’ token
21  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 09, 2012, 09:38:50 pm
Ah ok. This was my confusion. I am using the arduino as an ISP. In the High-Low tech tutorial with their tiny core files there was a board selection for 'attiny85 with arduino as ISP' This new core wants me to program the attiny85 directly as I understand it. How do I do that?
22  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 09, 2012, 09:20:00 pm
Is it ok to use the tiny core you linked to for arduino version 1.0 if I have ardiuno 022 running? I can only get arduino as ISP running properly with 022.
23  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 09, 2012, 06:42:33 pm
Coding Badly and dxw00d,

How do I implement the solutions you link to into my code?

Thank you so much!

Will
24  Using Arduino / Programming Questions / Re: IR Code on Attiny gives error on: February 09, 2012, 03:16:11 pm
Just the raw attiny85 chip. My limited understanding was that UART refers to the hardware necessary to connect to the computer via USB. I am using the arduino's usb UART as i am using the arduino duemilanove as an ISP programmer to program the attiny85 on a breadboard.
25  Using Arduino / Programming Questions / IR Code on Attiny gives error on: February 09, 2012, 03:09:11 pm
I am using this code
Code:
/*
 * IRrecord: record and play back IR signals as a minimal
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * An IR LED must be connected to the output PWM pin 3.
 * A button must be connected to the input BUTTON_PIN; this is the
 * send button.
 * A visible LED can be connected to STATUS_PIN to provide status.
 *
 * The logic is:
 * If the button is pressed, send the IR code.
 * If an IR code is received, record it.
 *
 * Version 0.11 September, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>

int RECV_PIN = 11;
int BUTTON_PIN = 12;
int STATUS_PIN = 13;

IRrecv irrecv(RECV_PIN);
IRsend irsend;

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(BUTTON_PIN, INPUT);
  pinMode(STATUS_PIN, OUTPUT);
}

// Storage for the recorded code
int codeType = -1; // The type of code
unsigned long codeValue; // The code value if not raw
unsigned int rawCodes[RAWBUF]; // The durations if raw
int codeLen; // The length of the code
int toggle = 0; // The RC5/6 toggle state

// Stores the code for later playback
// Most of this code is just logging
void storeCode(decode_results *results) {
  codeType = results->decode_type;
  int count = results->rawlen;
  if (codeType == UNKNOWN) {
    Serial.println("Received unknown code, saving as raw");
    codeLen = results->rawlen - 1;
    // To store raw codes:
    // Drop first value (gap)
    // Convert from ticks to microseconds
    // Tweak marks shorter, and spaces longer to cancel out IR receiver distortion
    for (int i = 1; i <= codeLen; i++) {
      if (i % 2) {
        // Mark
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;
        Serial.print(" m");
      }
      else {
        // Space
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;
        Serial.print(" s");
      }
      Serial.print(rawCodes[i - 1], DEC);
    }
    Serial.println("");
  }
  else {
    if (codeType == NEC) {
      Serial.print("Received NEC: ");
      if (results->value == REPEAT) {
        // Don't record a NEC repeat value as that's useless.
        Serial.println("repeat; ignoring.");
        return;
      }
    }
    else if (codeType == SONY) {
      Serial.print("Received SONY: ");
    }
    else if (codeType == RC5) {
      Serial.print("Received RC5: ");
    }
    else if (codeType == RC6) {
      Serial.print("Received RC6: ");
    }
    else {
      Serial.print("Unexpected codeType ");
      Serial.print(codeType, DEC);
      Serial.println("");
    }
    Serial.println(results->value, HEX);
    codeValue = results->value;
    codeLen = results->bits;
  }
}

void sendCode(int repeat) {
  if (codeType == NEC) {
    if (repeat) {
      irsend.sendNEC(REPEAT, codeLen);
      Serial.println("Sent NEC repeat");
    }
    else {
      irsend.sendNEC(codeValue, codeLen);
      Serial.print("Sent NEC ");
      Serial.println(codeValue, HEX);
    }
  }
  else if (codeType == SONY) {
    irsend.sendSony(codeValue, codeLen);
    Serial.print("Sent Sony ");
    Serial.println(codeValue, HEX);
  }
  else if (codeType == RC5 || codeType == RC6) {
    if (!repeat) {
      // Flip the toggle bit for a new button press
      toggle = 1 - toggle;
    }
    // Put the toggle bit into the code to send
    codeValue = codeValue & ~(1 << (codeLen - 1));
    codeValue = codeValue | (toggle << (codeLen - 1));
    if (codeType == RC5) {
      Serial.print("Sent RC5 ");
      Serial.println(codeValue, HEX);
      irsend.sendRC5(codeValue, codeLen);
    }
    else {
      irsend.sendRC6(codeValue, codeLen);
      Serial.print("Sent RC6 ");
      Serial.println(codeValue, HEX);
    }
  }
  else if (codeType == UNKNOWN /* i.e. raw */) {
    // Assume 38 KHz
    irsend.sendRaw(rawCodes, codeLen, 38);
    Serial.println("Sent raw");
  }
}

int lastButtonState;

void loop() {
  // If button pressed, send the code.
  int buttonState = digitalRead(BUTTON_PIN);
  if (lastButtonState == HIGH && buttonState == LOW) {
    Serial.println("Released");
    irrecv.enableIRIn(); // Re-enable receiver
  }

  if (buttonState) {
    Serial.println("Pressed, sending");
    digitalWrite(STATUS_PIN, HIGH);
    sendCode(lastButtonState == buttonState);
    digitalWrite(STATUS_PIN, LOW);
    delay(50); // Wait a bit between retransmissions
  }
  else if (irrecv.decode(&results)) {
    digitalWrite(STATUS_PIN, HIGH);
    storeCode(&results);
    irrecv.resume(); // resume receiver
    digitalWrite(STATUS_PIN, LOW);
  }
  lastButtonState = buttonState;
}





 from this tutorial
 http://www.arcfn.com/2009/09/arduino-universal-remote-record-and.html to program an attiny85 to record and replay ir signals.


The program works fine on the atmega 328. I know I can program the  attiny85 with arduino as ISP because I have successfully loaded multiple sketches onto it in this way. However, when I attempt to load the sketch to the attiny85 I get this error message:
Code:
IRrecord.cpp: In function ‘void setup()’:
IRrecord.cpp:36:3: error: ‘Serial’ was not declared in this scope
IRrecord.cpp: In function ‘void storeCode(decode_results*)’:
IRrecord.cpp:55:5: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:72:37: error: ‘DEC’ was not declared in this scope
IRrecord.cpp:78:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:86:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:89:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:92:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:95:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:96:30: error: ‘DEC’ was not declared in this scope
IRrecord.cpp:99:5: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:99:36: error: ‘HEX’ was not declared in this scope
IRrecord.cpp: In function ‘void sendCode(int)’:
IRrecord.cpp:109:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:113:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:114:33: error: ‘HEX’ was not declared in this scope
IRrecord.cpp:119:5: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:120:31: error: ‘HEX’ was not declared in this scope
IRrecord.cpp:131:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:132:33: error: ‘HEX’ was not declared in this scope
IRrecord.cpp:137:7: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:138:33: error: ‘HEX’ was not declared in this scope
IRrecord.cpp:144:5: error: ‘Serial’ was not declared in this scope
IRrecord.cpp: In function ‘void loop()’:
IRrecord.cpp:154:5: error: ‘Serial’ was not declared in this scope
IRrecord.cpp:159:5: error: ‘Serial’ was not declared in this scope

What is going wrong?

Thanks,

Will
26  Using Arduino / Programming Questions / Re: Attiny 85 problems on: February 09, 2012, 12:05:46 pm
found the solution here:

http://code.google.com/p/arduino-tiny/issues/detail?id=29
27  Using Arduino / Programming Questions / Re: Attiny 85 problems on: February 09, 2012, 11:46:44 am
No, I am using arduino version 022 as shown in the original mit link.
28  Using Arduino / Programming Questions / Re: Attiny 85 problems on: February 09, 2012, 11:30:06 am
Sorry PaulS. To clarify, I am using the arduino as an isp programmer to program the attiny85

The code is all default code. I used the Arduino ISP example sketch and the blink example sketch.

I have triple checked all the connections between the arduino and the attiny 85 on the breadboard.

I used the 10uF cap to turn of auto reset by placing it between reset and ground on the arduino.

Here is the code for the blink example sketch:

Code:
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(0, OUTPUT);     
}

void loop() {
  digitalWrite(0, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(0, LOW);    // set the LED off
  delay(1000);              // wait for a second
}
29  Using Arduino / Programming Questions / Attiny 85 problems on: February 09, 2012, 10:58:28 am
I am following the MIT http://hlt.media.mit.edu/?p=1229 and MAKE http://blog.makezine.com/2011/10/10/how-to-shrinkify-your-arduino-projects/ tutorials for programming a attiny85 with arduino as ISP. I keep running into this error message when attempting to load the blink sketch to the attiny85:

Code:
In file included from /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:44:0,
                 from /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/delay.h:37,
                 from /home/will/sketchbook/hardware/attiny45_85/cores/attiny45_85/wiring_private.h:32,
                 from /home/will/sketchbook/hardware/attiny45_85/cores/attiny45_85/WInterrupts.c:36:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected ‘)’ before ‘>=’ token

I have triple checked all the connections. I have used the 10uF cap as shown in the MAKE video. I have tried multiple versions of the ArduinoISP sketch.

I am using a duemilanove board.

Any thoughts?

Thanks very much,

Will
30  Using Arduino / Programming Questions / Re: Arduino ISP Bootload Not Working on: December 30, 2011, 02:47:33 am
Thanks to the community I was able to make this tutorial on soldering your own bootloader shield!

http://revoltlab.com/projects/boot-bot-arduino-cloner/

Thanks again!
Pages: 1 [2] 3 4 5