You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i use Virtual Wire with esp8266 I get error,Please help me to get rid of it
It would be of use to lot
I have used virtual eire library with arduino and it is perfect ...so please help me to sort this error
My code is
#include <VirtualWire.h> //Load the library
float temp; //Define the temp float variable
int sensor = 0; // sensor middle pin on analog pin 0
char msg[6];
void setup()
{
Serial.begin(9600);
vw_set_tx_pin(12);
//vw_set_tx_pin(D6);// Sets pin D12 as the TX pin
vw_setup(2000); // Bits per sec
pinMode(LED_BUILTIN,OUTPUT);
}
void loop()
{
//temp = analogRead(sensor); //assigning the analog output to temp
//temp = temp * 0.48828125; //converting volts to degrees celsius ----- 0.48828125 = [(5V*1000)/1024]10
temp=1;
dtostrf(temp, 6,2,msg); //converts the float into a char
Serial.println(vw_send((uint8_t *)msg, strlen(msg))); //transmits the data
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(LED_BUILTIN,HIGH);
//Serial.begin("HIGH");
delay(1000);
digitalWrite(LED_BUILTIN,LOW);
//Serial.begin("LOW");
}
My error is,
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp: In function 'void vw_setup(uint16_t)':
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:370:5: error: 'TCCR1A' was not declared in this scope
TCCR1A = 0; // Output Compare pins disconnected
^
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:371:5: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(WGM12); // Turn on CTC mode
^
In file included from C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.h:146:0,
from C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:31:
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:371:18: error: 'WGM12' was not declared in this scope
TCCR1B = _BV(WGM12); // Turn on CTC mode
^
C:\Users\ANAND\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/Arduino.h:184:25: note: in definition of macro '_BV'
#define _BV(b) (1UL << (b))
^
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:378:5: error: 'OCR1A' was not declared in this scope
OCR1A = nticks;
^
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:385:5: error: 'TIMSK' was not declared in this scope
TIMSK |= _BV(OCIE1A);
^
In file included from C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.h:146:0,
from C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:31:
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:385:18: error: 'OCIE1A' was not declared in this scope
TIMSK |= _BV(OCIE1A);
^
C:\Users\ANAND\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/Arduino.h:184:25: note: in definition of macro '_BV'
#define _BV(b) (1UL << (b))
^
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp: At global scope:
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:568:7: error: expected constructor, destructor, or type conversion before '(' token
SIGNAL(TIMER1_COMPA_vect)
^
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:648:1: error: expected '}' at end of input
}
^
Using library VirtualWire in folder: C:\Program Files (x86)\Arduino\libraries\VirtualWire (legacy)
exit status 1
Error compiling for board Generic ESP8266 Module.
Thanks in advance
The text was updated successfully, but these errors were encountered:
I was looking through our issues and noticed your question. The legacy VirtualWire Library was written for AVR microcontrollers and use specific AVR registers. The ESP8266 is a different architecture. This is why the compiler is giving errors indicating that certain definitions are not declared (i.e. TCCR1A and TCCR1B). You will need to use a different library to compile the RF Links.
I have not tried this but it looks like the RadioHead library might be a solution if you are still wondering. There are a few examples online that use an ESP8266 with the RadioHead Library so it should work.
when i use Virtual Wire with esp8266 I get error,Please help me to get rid of it
It would be of use to lot
I have used virtual eire library with arduino and it is perfect ...so please help me to sort this error
My code is
#include <VirtualWire.h> //Load the library
float temp; //Define the temp float variable
int sensor = 0; // sensor middle pin on analog pin 0
char msg[6];
void setup()
{
Serial.begin(9600);
vw_set_tx_pin(12);
//vw_set_tx_pin(D6);// Sets pin D12 as the TX pin
vw_setup(2000); // Bits per sec
pinMode(LED_BUILTIN,OUTPUT);
}
void loop()
{
//temp = analogRead(sensor); //assigning the analog output to temp
//temp = temp * 0.48828125; //converting volts to degrees celsius ----- 0.48828125 = [(5V*1000)/1024]10
temp=1;
dtostrf(temp, 6,2,msg); //converts the float into a char
Serial.println(vw_send((uint8_t *)msg, strlen(msg))); //transmits the data
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(LED_BUILTIN,HIGH);
//Serial.begin("HIGH");
delay(1000);
digitalWrite(LED_BUILTIN,LOW);
//Serial.begin("LOW");
}
My error is,
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp: In function 'void vw_setup(uint16_t)':
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:370:5: error: 'TCCR1A' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:371:5: error: 'TCCR1B' was not declared in this scope
In file included from C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.h:146:0,
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:371:18: error: 'WGM12' was not declared in this scope
C:\Users\ANAND\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/Arduino.h:184:25: note: in definition of macro '_BV'
#define _BV(b) (1UL << (b))
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:378:5: error: 'OCR1A' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:385:5: error: 'TIMSK' was not declared in this scope
In file included from C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.h:146:0,
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:385:18: error: 'OCIE1A' was not declared in this scope
C:\Users\ANAND\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/Arduino.h:184:25: note: in definition of macro '_BV'
#define _BV(b) (1UL << (b))
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp: At global scope:
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:568:7: error: expected constructor, destructor, or type conversion before '(' token
SIGNAL(TIMER1_COMPA_vect)
C:\Program Files (x86)\Arduino\libraries\VirtualWire\VirtualWire.cpp:648:1: error: expected '}' at end of input
}
^
Using library VirtualWire in folder: C:\Program Files (x86)\Arduino\libraries\VirtualWire (legacy)
exit status 1
Error compiling for board Generic ESP8266 Module.
Thanks in advance
The text was updated successfully, but these errors were encountered: