Hi,
is it possible to use espnow.h to send sensor value from esp8266 to esp32?
tnks
esp8266 to esp32 with espnow.h
esp8266 to esp32 with espnow.h
Last edited by cepics on Sun Dec 09, 2018 7:04 pm, edited 1 time in total.
Re: esp8266 to esp32 with espnow.h
Hi all,
Im trying this example code https://github.com/leonyuhanov/ESP-NOW-TX-RX
uploading and running this sketch on esp8266 tx side: https://github.com/leonyuhanov/ESP-NOW- ... smiter.ino
and this is the serial monitor tx side (esp8266) output:
... and this sketch on the rx side (esp32): https://github.com/leonyuhanov/ESP-NOW- ... ceiver.ino
with tis output on serial moritor:
I'm a super newbi and I don't understand why data are not passing.....
any idea?
help please !!!
best regards
Im trying this example code https://github.com/leonyuhanov/ESP-NOW-TX-RX
uploading and running this sketch on esp8266 tx side: https://github.com/leonyuhanov/ESP-NOW- ... smiter.ino
Code: Select all
#include <ESP8266WiFi.h>
extern "C" {
#include <espnow.h>
}
#define WIFI_CHANNEL 1
//MAC ADDRESS OF THE DEVICE YOU ARE SENDING TO
//byte remoteMac[] = {0x36, 0x33, 0x33, 0x33, 0x33, 0x33};
byte remoteMac[] = {0x80, 0x7D, 0x3A, 0xDC, 0xB3, 0x95};
const byte dataLength=7;
byte cnt=0;
byte rcvData[dataLength];
byte result;
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin();
Serial.print("\r\n\r\nDevice MAC: ");
Serial.println(WiFi.macAddress());
Serial.println("\r\nESP_Now Controller.");
esp_now_init();
delay(10);
esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);
esp_now_add_peer(remoteMac, ESP_NOW_ROLE_COMBO, WIFI_CHANNEL, NULL, 0);
}
void loop()
{
for(cnt=0; cnt<dataLength; cnt++)
{
rcvData[cnt]++;
}
result = esp_now_send(remoteMac, rcvData, dataLength);
Serial.println(result);
delay(100);
}
Code: Select all
Device MAC: 60:01:94:29:DC:D7
ESP_Now Controller.
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Code: Select all
/*
Compiled for the NODEMCU-32S
*/
#include <esp_now.h>
#include <WiFi.h>
#define WIFI_CHANNEL 1
//uint8_t localCustomMac[] = {0x36, 0x33, 0x33, 0x33, 0x33, 0x33};
uint8_t localCustomMac[] = {0x80, 0x7D, 0x3A, 0xDC, 0xB3, 0x95};
//80:7D:3A:DC:B3:95
const byte maxDataFrameSize = 100;
byte cnt=0;
void setup()
{
Serial.begin(115200);
Serial.print("\r\n\r\n");
WiFi.mode(WIFI_AP);
Serial.println( WiFi.softAPmacAddress() );
WiFi.disconnect();
if(esp_now_init() == ESP_OK)
{
Serial.println("ESPNow Init Success!");
}
else
{
Serial.println("ESPNow Init Failed....");
}
esp_now_register_recv_cb(OnDataRecv);
}
void loop()
{
yield();
}
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len)
{
Serial.printf("\r\nReceived\t%d Bytes\t%d", data_len, data[0]);
}
Code: Select all
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9220
load:0x40080400,len:6300
entry 0x400806a4
80:7D:3A:DC:B3:95
ESPNow Init Success!
any idea?
help please !!!
best regards
Who is online
Users browsing this forum: No registered users and 56 guests