8

I am creating a wireless sensor using an Attiny85. I want to send the data to an arduino uno, so I purchased the 315mhz rf link kit from spark fun. Since the Attiny85 does not have a TX I decided to use the Manchester library however it won't compile on the Attiny85.

I followed the steps from this blog : http://mchr3k-arduino.blogspot.mx/2012/01/wireless-sensor-node-part-2.html?showComment=1338749638806#c853067277980266192

Here is the code I am using:

 #include <WProgram.h> //otherwise it says it can't find Arduino.h
 #include <Manchester.h> //include the library to comunicate
 #define TxPin 2 //the pin that is used to send data
 int sensorPin = 4;
 int ledPin = 3;
 int count = 50;
 void setup(){
 pinMode (ledPin, OUTPUT);
 man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
 man.setupTransmit(TxPin, MAN_1200); //set transimt pin
}
void loop(){
 if (count == 50){
 digitalWrite (ledPin, HIGH);
 count = 0;
 }
 int data = analogRead(sensorPin);
 man.transmit(data); //transmits and reads the data
 delay (100);
 count ++;
 }

Here is the error message:

/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp: In function 'void MANRX_SetupReceive(uint8_t)':
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:366: error: 'TCCR2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:366: error: 'WGM21' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:368: error: 'TCCR2B' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:368: error: 'CS21' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:369: error: 'OCR2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:379: error: 'TIMSK2' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:379: error: 'OCIE2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:380: error: 'TCNT2' was not declared in this scope
sachleen
7,5655 gold badges40 silver badges57 bronze badges
asked Apr 26, 2014 at 21:38
4
  • Which package are you using for ATtinyX5 Arduino support? Commented Apr 26, 2014 at 22:01
  • I tried the one from the blog I referenced but after google searching I found that the MIT High Low Tech Group had one so I tried that one as well. The one from MIT High Low Tech is from this page highlowtech.org/?p=1695 Commented Apr 26, 2014 at 22:11
  • I performed all of Joel's and Ignacio's suggestions concerning using the arduino-tiny library instead of the attiny master from the MIT high low tech group page. I've finally got the ATTINY85 boards to show up in my board menu, but I'm still getting the error "man not declared in scope" with the above code. Any suggestions? Commented Jan 16, 2015 at 20:08
  • Did you import the manchester library into the Arduino IDE? or Place it in the libraries folder? Commented Jan 18, 2015 at 20:41

3 Answers 3

5

attiny is missing an option required to allow the Manchester library to function properly on ATtinyX5 devices, specifically definition of __AVR_ATtinyX5__ when a device is selected. In fact, it's missing quite a few things.

The package I use for ATtinyX5 support is arduino-tiny. I have verified that it defines that symbol properly. I recommend that you dump your current support package and install arduino-tiny instead.

answered Apr 26, 2014 at 22:38
9
  • I downloaded the arduino-tiny-0150-0020.zip. Unzipped the file then dragged the folder named tiny into the hardware folder I created inside the arduino folder. However when I went to the ide I searched under boards and the Attiny series of boards did not show up. Commented Apr 26, 2014 at 23:08
  • What is the correct way to add the package to the ice? Commented Apr 26, 2014 at 23:08
  • Which version of the IDE are you running? Commented Apr 26, 2014 at 23:27
  • Arduino1.0.5 on mac osx 10.9.2 Commented Apr 26, 2014 at 23:30
  • Then you'll need to download the support package for 1.0.x instead of the one for 1.5.x. Commented Apr 26, 2014 at 23:31
4

Having struggled through this myself, I can confirm that Joel's solution works.

There are quite a lot of posts around that suggests that you can't get the Manchester to work with Arduino1.0x and you need 0020. But you can.

The key is to use the arduino-tiny from the link above, put the tiny folder which you get from there in /hardware and then rename it to attiny and "prospective boards" to boards.

I realise that this doesn’t say any more than Joel already has, but there is so much conflicting and contradictory information around I thought it would be worth adding in my experience

answered Jun 3, 2014 at 12:42
0

Got the same problem using this lib with a 8 MHz Trinket, but managed to solve it by adding #define __AVR_ATtinyX5__ to the file hardware/attiny/variants/tiny8/pins_arduino.h. I'm using the Adafruit support package for ATtiny. Perhaps a bit of a hack, but I can still build for the UNO, by selecting board in Arduino IDE 1.0.5.

answered Nov 20, 2014 at 19:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.