Sto creando un sensore wireless utilizzando un Attiny85. Voglio inviare i dati a uno Arduino Uno, quindi ho acquistato il kit di collegamento RF 315mhz da Spark Fun. Poiché Attiny85 non ha un TX, ho deciso di utilizzare la libreria di Manchester, ma non verrà compilato su Attiny85.
Ho seguito i passaggi di questo blog: http://mchr3k-arduino.blogspot.mx/2012/01/wireless-sensor-node-part-2.html?showComment=1338749638806#c853067277980266192
Ecco il codice che sto usando:
#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 ++;
}
Ecco il messaggio di errore:
/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