Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By RogerGuess
#16806 Seems I have gone about thing a little backwards compared to most. I have been playing with the ESP8266 longer than I have been playing around with Arduino. So I am quite new to most of this. I am not clear on why some sketches would not compile when targeting the ESP board in the Arduino IDE.

Can someone summarize a little bit for a newb like myself with little exposure to all this? How do you know when looking at a sketch if it is targeting a specific type of board or chipset? How do you know if an included library is specific to a board or chipset? I have seen things like wire.h, and TinyWireM.h, and do not grasp the difference when neither seem to help with the ESP. In another example, I was trying to talk to a BMP180 temp/pressure sensor (adafruit module and sketch) with the 8266 and it is missing a file called avr\pgmspace.h. Is there a good writeup somewhere on knowing how to tell if code is targeting specific architectures? I even ran into an example where a sketch did not include any external libraries/files and yet there was an undefined function ( log() ):

https://learn.adafruit.com/thermistor/u ... emperature
User avatar
By Pigs Fly
#17710 There's probably going to be some of that incompatibility on 3rd-party libraries, but it's off to a pretty good start from what I've seen so far. In the library code you'll often see conditional compiler directives based on the processor & board specified in the IDE. Like this from the SPI lib which has to do with different devices having different or more numerous timers:

Code: Select all#elif defined(__AVR_ATmega128__) ||defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
#define _useTimer3
#define _useTimer1
typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;

#else  // everything else
#define _useTimer1
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;                 
#endif



Too bad about that BMP180 - I was just about to connect one of those and I see that you are correct - it doesn't compile. I'll look at that later, but it seems odd since the Wire library has been ported and beyond that there's nothing special about talking to the BMP180 beyond the long list of adjustments from the returned data.

A thread on library status here:

viewtopic.php?f=27&t=2156