Hi there,
I’ve now had success in programming a Wemos D1 Mini on my Mac using the Arduino IDE application which is great.
I’ve just purchased an Arduino Nano (https://www.ebay.co.uk/itm/Mini-USB-Arduino-Nano-Compatible-V3-0-ATmega328P-5V-16MHz-SOLDERED-HEADERS/262738901345?ssPageName=STRK%3AMEBIDX%3AIT&var=561685003914&_trksid=p2057872.m2749.l2648) and am now trying to upload the same sketch that I uploaded to the Wemos D1 Mini to the Nano.
As this is a ‘compatible’ Nano I’m not totally sure that I have everything set correctly as it took me forever to figure out I needed the Programmer to be Arduino as ISP instead of AVRIPS mkii which it was originally set to for the D1 Mini and also had to change the Processor to ATmega328P (Old Bootloader) instead of ATmega328P which I had it on for the Wemos D1 Mini.
Even then I’m not totally certain that’s all correct even though it did upload and work?
Just messing with every single possible variant of board, processor and programmer took me forever to even get anything uploaded to it but in the end it did upload a very simple blink sketch which I added in a serial print so I could tell that my sketch was definitely uploaded (it already had a blink sketch on it so placing the serial print message in there let me know for definite that my sketch had uploaded).
Now I’ve just tried uploading the sketch I had on my Wemos D1 Mini to the Nano and I get an error immediately saying :
Blynk_-_Read_Value:9:10: fatal error: ESP8266WiFi.h: No such file or directory
#include <ESP8266WiFi.h>
^~~~~~~~~~~~~~~
compilation terminated.
exit status 1
ESP8266WiFi.h: No such file or directory
The sketch I’m trying to upload is this :
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "My Wifi Name";
char pass[] = "xxxxxxxxxxxxxx";
BlynkTimer timer;
// Setup timer function
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
/* Serial.println("Checking to see if Blynk is up and running"); */
if(!Blynk.connected())
{
Serial.println("Reconnecting ... ");
Blynk.connect();
Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,82), 8080);
}
}
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V1)
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
/*pinValue = map(pinValue, 0, 1023, 0, 127);*/
Serial.println(pinValue);
// process received value
}
/* Get and send GPS co-ordinates */
BLYNK_WRITE(V2)
{
GpsParam gps(param);
// Print 6 decimal places for Lat
/* Serial.println(gps.getLat(), 7);
Serial.println(gps.getLon(), 7);
Serial.println(gps.getAltitude(), 2);
Serial.println(gps.getSpeed(), 2);*/
/* Send GPS Co-ordinates to Blynk to show on map in iPhone App */
int index = 0;
float lat = (gps.getLat(), 7);
float lon = (gps.getLon(), 7);
Serial.println("LATITUDE = ");
Serial.println(gps.getLat(), 7);
Serial.println("LONGITUDE = ");
Serial.println(gps.getLon(), 7);
Blynk.virtualWrite(V10, index, gps.getLat(), gps.getLon(), "value");
}
/* Turn LED on and off */
BLYNK_WRITE(V3)
{
int pinValue = param.asInt(); // assigning incoming value from pin V3 to a variable
if (pinValue == 1)
{
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Turning LED ON");
} else
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("Turning LED OFF");
}
/* Everything in here only runs once */
void setup()
{
// Set onboard LED
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,82), 8080);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
/* This is our main loop. Everything in here will happen many times */
void loop()
{
/* ONLY ORIGINAL LINE BELOW */
Blynk.run();
/* ONLY ORIGINAL LINE ABOVE */
timer.run();
}
Does anyone know why this isn’t working? I’m actually going to be creating something completely different for the Nano (hopefully if I can get that to work!) but just wanted to try this sketch first as it works fine on the Wemos D1 Mini so wanted to try it out on the new board to see it all working on it. It won’t upload though so not too sure what I have wrong and where?
Many thanks for any help with this.
Best wishes,
Mark
• Hardware as shown in link above to Amazon :
• Local Blynk server running on OSX. All working fine as already working with Wemos D1 Mini